1- # 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 )
1+ # 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 )
22
33> ` shallowequal ` is like lodash's [ ` isEqual ` ] ( https://lodash.com/docs/3.10.1#isEqual ) (v3.10.1) but for shallow (strict) equal.
44
@@ -20,17 +20,17 @@ The `customizer` is bound to `thisArg` and invoked with three arguments: `(value
2020## Install
2121
2222``` sh
23- $ yarn add shallowequal
24- # npm v5+
25- $ npm install shallowequal
26- # before npm v5
27- $ npm install --save shallowequal
23+ pnpm add shallowequal
24+ # or
25+ npm install shallowequal
26+ # or
27+ yarn add shallowequal
2828```
2929
3030## Usage
3131
3232``` js
33- const shallowequal = require ( " shallowequal" ) ;
33+ import shallowequal from " shallowequal" ;
3434
3535const object = { user: " fred" };
3636const other = { user: " fred" };
@@ -42,22 +42,63 @@ shallowequal(object, other);
4242// → true
4343```
4444
45+ ### TypeScript
46+
47+ This package includes TypeScript type definitions:
48+
49+ ``` ts
50+ import shallowequal , { Comparator } from " shallowequal" ;
51+
52+ const customCompare: Comparator = (a , b , key ) => {
53+ // Custom comparison logic
54+ return undefined ; // Fall back to default comparison
55+ };
56+
57+ shallowequal ({ a: 1 }, { a: 1 }, customCompare );
58+ // → true
59+ ```
60+
4561## Credit
4662
4763Code 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 ` ).
4864
4965## Development
5066
51- - ` node.js ` and ` npm ` . See: https://github.com/creationix/nvm#installation
52- - ` yarn ` . See: https://yarnpkg.com/en/docs/install
53- - ` npm ` dependencies. Run: ` yarn install `
67+ Prerequisites:
68+ - [ Node.js] ( https://nodejs.org/ ) (v18+)
69+ - [ pnpm] ( https://pnpm.io/ )
70+
71+ ### Setup
72+
73+ ``` sh
74+ pnpm install
75+ ```
76+
77+ ### Commands
5478
55- ### Chores
79+ Using Make:
5680
57- - Lint: ` yarn lint `
58- - Test: ` yarn test `
59- - Pretty: ` yarn pretty `
60- - Prepare: ` yarn prepare `
81+ ``` sh
82+ make install # Install dependencies
83+ make build # Build the project
84+ make test # Run tests
85+ make test-watch # Run tests in watch mode
86+ make lint # Run linter
87+ make typecheck # Run type checking
88+ make clean # Clean build artifacts
89+ make ci # Run full CI pipeline
90+ ```
91+
92+ Or using pnpm directly:
93+
94+ ``` sh
95+ pnpm install # Install dependencies
96+ pnpm build # Build the project
97+ pnpm test # Run tests
98+ pnpm test:watch # Run tests in watch mode
99+ pnpm lint # Run linter
100+ pnpm typecheck # Run type checking
101+ ```
61102
62103## License
63104
0 commit comments