{"id":19561863,"url":"https://github.com/ajihyf/shallow-equal-jit","last_synced_at":"2026-05-13T08:06:14.708Z","repository":{"id":42837464,"uuid":"264328416","full_name":"ajihyf/shallow-equal-jit","owner":"ajihyf","description":"Fast object shallow equal using Just-In-Time compiled functions.","archived":false,"fork":false,"pushed_at":"2023-01-06T06:01:52.000Z","size":1268,"stargazers_count":2,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T12:17:51.048Z","etag":null,"topics":["memo","pure","shallow-equal","shouldcomponentupdate"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajihyf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-16T00:35:43.000Z","updated_at":"2024-07-10T08:48:28.000Z","dependencies_parsed_at":"2023-02-05T12:00:32.498Z","dependency_job_id":null,"html_url":"https://github.com/ajihyf/shallow-equal-jit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fshallow-equal-jit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fshallow-equal-jit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fshallow-equal-jit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fshallow-equal-jit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajihyf","download_url":"https://codeload.github.com/ajihyf/shallow-equal-jit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240822608,"owners_count":19863302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["memo","pure","shallow-equal","shouldcomponentupdate"],"created_at":"2024-11-11T05:12:45.951Z","updated_at":"2026-05-13T08:06:14.642Z","avatar_url":"https://github.com/ajihyf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shallow-equal-jit\n\n[![npm](https://img.shields.io/npm/v/shallow-equal-jit.svg)](https://www.npmjs.com/package/shallow-equal-jit)\n[![Actions Status](https://github.com/ajihyf/shallow-equal-jit/workflows/CI/badge.svg)](https://github.com/ajihyf/shallow-equal-jit/actions)\n\nFast shallow equal with Just-In-Time compiled compare functions.\n\n## Installation\n\n```bash\nnpm install shallow-equal-jit --save\n# or\nyarn add shallow-equal-jit\n```\n\n## Usage\n\n```ts\nimport { shallowEqualJIT } from 'shallow-equal-jit';\n\n// generate equal function\nconst shallowEqual = shallowEqualJIT(['a', 'b']);\n\nconsole.log(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2 })); // true\n// keys except for a and b are ignored\nconsole.log(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })); // true\n\nconsole.log(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 3 })); // false\n```\n\nBy default, this library uses `Object.is` for comparison, you can pass a second argument as `true` to use `===` operator.\n\n```ts\nconst shallowEqualUsingStrictEq = shallowEqualJIT(['a', 'b'], true);\n```\n\n## Benchmark\n\nThe following results were produced under Node v12.16.3 on a MacBook Pro (Early 2015) 2.7 GHz Intel Core i5.\n\n```\nshallowequal (object, equal) x 3,273,287 ops/sec ±1.30% (91 runs sampled)\nshallowequal (object, same) x 831,562,263 ops/sec ±1.91% (87 runs sampled)\nshallowequal (object, unequal) x 5,090,021 ops/sec ±0.88% (84 runs sampled)\n\nis-equal-shallow (object, equal) x 4,010,229 ops/sec ±0.36% (89 runs sampled)\nis-equal-shallow (object, same) x 12,001,915 ops/sec ±0.47% (87 runs sampled)\nis-equal-shallow (object, unequal) x 7,006,307 ops/sec ±0.27% (91 runs sampled)\n\nshallow-equals (object, equal) x 7,306,243 ops/sec ±1.32% (91 runs sampled)\nshallow-equals (object, same) x 21,384,443 ops/sec ±0.18% (91 runs sampled)\nshallow-equals (object, unequal) x 12,936,562 ops/sec ±1.07% (90 runs sampled)\n\nfbjs/lib/shallowEqual (object, equal) x 3,025,569 ops/sec ±0.18% (93 runs sampled)\nfbjs/lib/shallowEqual (object, same) x 826,443,739 ops/sec ±1.03% (88 runs sampled)\nfbjs/lib/shallowEqual (object, unequal) x 4,535,318 ops/sec ±0.19% (90 runs sampled)\n\nfast-equals.shallowEqual (object, equal) x 3,080,743 ops/sec ±0.22% (91 runs sampled)\nfast-equals.shallowEqual (object, same) x 830,713,756 ops/sec ±0.91% (90 runs sampled)\nfast-equals.shallowEqual (object, unequal) x 4,740,245 ops/sec ±0.98% (91 runs sampled)\n\nfast-shallow-equal (object, equal) x 3,129,008 ops/sec ±0.42% (88 runs sampled)\nfast-shallow-equal (object, same) x 841,791,886 ops/sec ±0.83% (89 runs sampled)\nfast-shallow-equal (object, unequal) x 4,513,256 ops/sec ±0.39% (93 runs sampled)\n\n@wordpress/is-shallow-equal (object, equal) x 4,353,487 ops/sec ±0.37% (91 runs sampled)\n@wordpress/is-shallow-equal (object, same) x 206,089,794 ops/sec ±0.28% (90 runs sampled)\n@wordpress/is-shallow-equal (object, unequal) x 6,674,242 ops/sec ±0.31% (88 runs sampled)\n\nshallow-equal-jit (object, equal) x 836,387,131 ops/sec ±0.83% (89 runs sampled)\nshallow-equal-jit (object, same) x 836,515,680 ops/sec ±0.94% (89 runs sampled)\nshallow-equal-jit (object, unequal) x 828,178,623 ops/sec ±1.03% (87 runs sampled)\n\nshallow-equal-jit (===) (object, equal) x 832,237,483 ops/sec ±1.08% (87 runs sampled)\nshallow-equal-jit (===) (object, same) x 838,105,210 ops/sec ±0.96% (88 runs sampled)\nshallow-equal-jit (===) (object, unequal) x 843,725,200 ops/sec ±0.76% (91 runs sampled)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajihyf%2Fshallow-equal-jit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajihyf%2Fshallow-equal-jit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajihyf%2Fshallow-equal-jit/lists"}