Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .flowconfig

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18, 20, 22]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Run CI
run: make ci
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
.DS_Store
modules
*.log
*.tsbuildinfo
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.PHONY: install build test test-watch lint typecheck clean all ci

# Default target
all: install lint typecheck test build

# Install dependencies
install:
pnpm install

# Build the project
build:
pnpm build

# Run tests
test:
pnpm test

# Run tests in watch mode
test-watch:
pnpm test:watch

# Run linter
lint:
pnpm lint

# Run type checking
typecheck:
pnpm typecheck

# Clean build artifacts
clean:
rm -rf dist node_modules

# CI target - runs all checks
ci: install lint typecheck test build
71 changes: 56 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# shallowequal [![Build Status](https://travis-ci.org/dashed/shallowequal.svg)](https://travis-ci.org/dashed/shallowequal) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)
# shallowequal [![CI](https://github.com/dashed/shallowequal/actions/workflows/ci.yml/badge.svg)](https://github.com/dashed/shallowequal/actions/workflows/ci.yml) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)

> `shallowequal` is like lodash's [`isEqual`](https://lodash.com/docs/3.10.1#isEqual) (v3.10.1) but for shallow (strict) equal.

Expand All @@ -20,17 +20,17 @@ The `customizer` is bound to `thisArg` and invoked with three arguments: `(value
## Install

```sh
$ yarn add shallowequal
# npm v5+
$ npm install shallowequal
# before npm v5
$ npm install --save shallowequal
pnpm add shallowequal
# or
npm install shallowequal
# or
yarn add shallowequal
```

## Usage

```js
const shallowequal = require("shallowequal");
import shallowequal from "shallowequal";

const object = { user: "fred" };
const other = { user: "fred" };
Expand All @@ -42,22 +42,63 @@ shallowequal(object, other);
// → true
```

### TypeScript

This package includes TypeScript type definitions:

```ts
import shallowequal, { Comparator } from "shallowequal";

const customCompare: Comparator = (a, b, key) => {
// Custom comparison logic
return undefined; // Fall back to default comparison
};

shallowequal({ a: 1 }, { a: 1 }, customCompare);
// → true
```

## Credit

Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).

## Development

- `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
- `yarn`. See: https://yarnpkg.com/en/docs/install
- `npm` dependencies. Run: `yarn install`
Prerequisites:
- [Node.js](https://nodejs.org/) (v18+)
- [pnpm](https://pnpm.io/)

### Setup

```sh
pnpm install
```

### Commands

### Chores
Using Make:

- Lint: `yarn lint`
- Test: `yarn test`
- Pretty: `yarn pretty`
- Prepare: `yarn prepare`
```sh
make install # Install dependencies
make build # Build the project
make test # Run tests
make test-watch # Run tests in watch mode
make lint # Run linter
make typecheck # Run type checking
make clean # Clean build artifacts
make ci # Run full CI pipeline
```

Or using pnpm directly:

```sh
pnpm install # Install dependencies
pnpm build # Build the project
pnpm test # Run tests
pnpm test:watch # Run tests in watch mode
pnpm lint # Run linter
pnpm typecheck # Run type checking
```

## License

Expand Down
12 changes: 0 additions & 12 deletions babel.config.js

This file was deleted.

20 changes: 20 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ["dist/**", "node_modules/**"],
},
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
},
}
);
46 changes: 0 additions & 46 deletions index.js

This file was deleted.

8 changes: 0 additions & 8 deletions index.js.flow

This file was deleted.

51 changes: 0 additions & 51 deletions index.original.js

This file was deleted.

Loading