{"_id":"@a11d/equals","_rev":"8-c6f6d0f58d1414ab7f2180f72514fb73","name":"@a11d/equals","dist-tags":{"latest":"0.2.3"},"versions":{"0.0.3":{"name":"@a11d/equals","version":"0.0.3","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.0.3","maintainers":[{"name":"arshia11d","email":"a11delavar@outlook.com"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"2336e8f31a392797186aba3ddec2528e9e1bc44b","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.0.3.tgz","fileCount":20,"integrity":"sha512-UWLAJKZRfQHenF2N1G2o9AcyLwOT0TtQCGl3ad0d6Et8xvwb6Zk2+podarsiaVJ1fPiA5o7ByQV8u9tYiKXVCA==","signatures":[{"sig":"MEUCIQDAEm7H/IqzvCbyFzzj3cN/0WMFWCjEW8jXYZ2HlRoATQIgEgDfSHEX03hMYORmm27ctio2vpFPuxxjn60AxB8EdcA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41490},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"57408b4aa88268269c3d41b555457724c0a4e611","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"9.6.2","description":"A value equality utility library.","directories":{},"_nodeVersion":"20.3.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.0.3_1698006412434_0.4173181350920101","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@a11d/equals","version":"0.1.0","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.1.0","homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"9122e0260a8931a54dea74d78f1d53b0e203c0ae","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.1.0.tgz","fileCount":26,"integrity":"sha512-BViKgze8SbZb9NQb110Ik9wvPf8XZTN8NNCdEYhhSOScFUL+v3zJJ+g8QOqpFYvDRAVmewcHFYuBOdyTGLxlgw==","signatures":[{"sig":"MEUCIQC+jZxtwF2SmE4J/uvUTJ3FvTtVgeTbGC+tR8jLCFGAbAIgTDz0vOEpg8GYz9vAGMiO4J2oIFjbTJNaFPuCATzDaBk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36793},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"2bbcba8a391802c185cd426899941dcbaffbc5d1","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"10.8.1","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.3.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.1.0_1719007951751_0.017565143399904226","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@a11d/equals","version":"0.1.1","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.1.1","homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"c8bd52aaf692392d38c15453dbd380945029b225","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.1.1.tgz","fileCount":26,"integrity":"sha512-/E6s338KioV6Jmm89rvfpcrwDdpr/tw/EJnvJQpBWQHVQZJyNm8gOEoKgyBSWgZMYsAe98dU3/wkvT6o+HXDfA==","signatures":[{"sig":"MEQCIDxrVMXegoU+qPhslgqpfIG5T44VUJV0Hlhal4bBm6W+AiAsTfJUcTe4U0XmLeYi/nAfCL8+xv5doVKQfs4XO/hBIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36807},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"b1a3781389eb0be8c602d01e58a1a9ff0fcfaf8e","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"10.8.1","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.3.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.1.1_1719008446529_0.4466354679614182","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@a11d/equals","version":"0.1.2","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.1.2","maintainers":[{"name":"arshia11d","email":"a11delavar@outlook.com"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"757025817ed945972a6b6d438adbc17719fe08d2","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.1.2.tgz","fileCount":26,"integrity":"sha512-IqsX+SxsSgUSBUUNsIkJkRIe6XrLkXp+T4jf/0CnOfXzPR0M2z8h5u8Zpsz39SMqNHMtBYLhsHkB76SMlPu6Ug==","signatures":[{"sig":"MEYCIQCjyArwfXBzhQEaTZiTvZ2cSWxVHy6+C0Z3lWy1OTvQigIhAIbFoagFiHJjQj/PUrrR2m3jcL6Rhl+1DNc1xtZ4car+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40218},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"3e33bfa5b0b4e328488c1e358431ff90e03b4c19","_npmUser":{"name":"arshia11d","email":"a11delavar@outlook.com"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"11.3.0","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.15.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.1.2_1747168084177_0.15105035429486935","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@a11d/equals","version":"0.2.0","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.2.0","maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"cd4a715a027ae8f4e568f86bcefe620c6f4bb0ff","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.2.0.tgz","fileCount":29,"integrity":"sha512-sVFrNjEEE1mq+wIT5URleBdoOpasFbvTFNwJNVi+UpP3/5ueZdsD+9Inp4SykLk/Yx1HcWNPTimAbzyWWwbEUw==","signatures":[{"sig":"MEYCIQCUJ4IE/FfHCu9Vh4rZdf7+LcENYmoeRAYbPDokHLxRxgIhAMnmr1HUy8YVIrGWAz+xP3NXyFmc7o1OMUw7OSjvTbVI","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43782},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"32a32cecb0056d1fcc842d7bd13e3dd1d2f7c4e0","_npmUser":{"name":"arshia11d","email":"a@delavar.net"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"11.6.0","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.2.0_1758369088929_0.5843281041473829","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@a11d/equals","version":"0.2.1","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.2.1","maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"c97ba91be0d1e0881346f79ee6e466592c455e25","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.2.1.tgz","fileCount":32,"integrity":"sha512-NpcBGKFvQiQ3tMGO//ZPQKUIMNIP8ZtlKgjMK7u4MhTCffrvtRq2jmAbV2mmODKA8TjGxsg5p/rYk0AqOwjTWw==","signatures":[{"sig":"MEUCIBbD0RZiiCUBqlyMukGefYWgYC1POjWWUS064XMM7Z7yAiEA2ZkzSM5Wotup+1V9eHey+29OzGw6zdyB8YhsTtzZ5po=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44825},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"cccc63bb83f3761531395237b551901b2ce91053","_npmUser":{"name":"arshia11d","email":"a@delavar.net"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"11.6.0","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.2.1_1758369832019_0.015170650365506466","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@a11d/equals","version":"0.2.2","keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","_id":"@a11d/equals@0.2.2","maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"homepage":"https://github.com/a11delavar/lit#readme","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"dist":{"shasum":"a39d44b348c5334fc965e36c85e94ebc713f9e7d","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.2.2.tgz","fileCount":32,"integrity":"sha512-QQ+bgilJns88Ftzmj7YGzpojphFw/9/KyZun/6loDNkD7T+Z8jBjCI+itiLwMzHnwQT8G15iuxUEWvgMYAmJUw==","signatures":[{"sig":"MEYCIQCZi+Atm/6Bo1qvKx9UnnJDvxaYlNeXZGPF3tKnW9V+3wIhAIEpzw6xlk1bMKxnGrYe6uTp42ZmDUT6mVBWOxytlTkF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45075},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"63194c31abe6cd99230e4f3a86f6cee35e1a81f8","_npmUser":{"name":"arshia11d","email":"a@delavar.net"},"repository":{"url":"git+https://github.com/a11delavar/lit.git","type":"git"},"_npmVersion":"11.6.0","description":"A value equality utility library.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/equals_0.2.2_1758660617032_0.16274597656455003","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@a11d/equals","version":"0.2.3","description":"A value equality utility library.","repository":{"type":"git","url":"git+https://github.com/a11delavar/lit.git"},"keywords":["object","equals","equality","value-equality"],"author":{"name":"a11delavar"},"license":"MIT","homepage":"https://github.com/a11delavar/lit#readme","type":"module","module":"./dist/index.js","main":"./dist/index.js","types":"./dist/index.d.ts","gitHead":"d94f20a4753f2aba5e2ce84ae07eb028f60af6ef","_id":"@a11d/equals@0.2.3","bugs":{"url":"https://github.com/a11delavar/lit/issues"},"_nodeVersion":"25.2.1","_npmVersion":"11.6.4","dist":{"integrity":"sha512-+D+n9EG9BmDqSOa0+x0f0YgMb0tbX903ygkncjokhNO2Y6FymRybudo3aPQM8Dnmeh7LI6dmBBX06g/A0YoDEg==","shasum":"223cfaa634920f0b0e0433e6326f0bc37f208582","tarball":"https://registry.npmjs.org/@a11d/equals/-/equals-0.2.3.tgz","fileCount":33,"unpackedSize":48465,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA1DL2kzIfZAvbygtss4DIaTTW5SIrcWvYeaeJAI9g40AiBMUgUTgNs8J4oRCiXai/9vA0Sw46u8H/m9gH6nZU1d2Q=="}]},"_npmUser":{"name":"arshia11d","email":"a@delavar.net"},"directories":{},"maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/equals_0.2.3_1765219248720_0.7982032435011623"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-22T20:26:52.304Z","modified":"2025-12-08T18:40:49.109Z","0.0.3":"2023-10-22T20:26:52.590Z","0.1.0":"2024-06-21T22:12:31.894Z","0.1.1":"2024-06-21T22:20:46.705Z","0.1.2":"2025-05-13T20:28:04.351Z","0.2.0":"2025-09-20T11:51:29.159Z","0.2.1":"2025-09-20T12:03:52.202Z","0.2.2":"2025-09-23T20:50:17.213Z","0.2.3":"2025-12-08T18:40:48.866Z"},"bugs":{"url":"https://github.com/a11delavar/lit/issues"},"author":{"name":"a11delavar"},"license":"MIT","homepage":"https://github.com/a11delavar/lit#readme","keywords":["object","equals","equality","value-equality"],"repository":{"type":"git","url":"git+https://github.com/a11delavar/lit.git"},"description":"A value equality utility library.","maintainers":[{"name":"arshia11d","email":"a@delavar.net"}],"readme":"# `@a11d/equals`\n\nValue equality for JavaScript. Compares objects, arrays, maps, sets, and functions by structure instead of reference.\n\n```typescript\nimport '@a11d/equals'\nimport { equals } from '@a11d/equals'\n\nconst obj1 = { a: 1, b: [1, 2, 3] }\nconst obj2 = { a: 1, b: [1, 2, 3] }\n\nObject[equals](obj1, obj2) // true\nobj1 === obj2 // false\n```\n\n## Installation\n\n```bash\nnpm install @a11d/equals\n```\n\n## Usage\n\nTwo APIs available:\n\n**Symbol-based** (recommended):\n```typescript\nimport { equals } from '@a11d/equals'\nobj[equals](other)\n```\n\n**Global methods** (for `.equals()` syntax or when the symbol conflicts with other libraries):\n```typescript\nimport '@a11d/equals/global'\nobj.equals(other)\n```\n\n## Built-in types\n\n<details>\n<summary><b>Objects</b> — Deep comparison of properties. Requires same constructor and all property values to be equal.</summary>\n\n**Objects with `valueOf()`**\n\nCompared by their primitive values:\n\n```typescript\nconst a = { valueOf: () => 1 }\nconst b = { valueOf: () => 1 }\n\nObject[equals](a, b) // true\n```\n\n**`undefined` vs absence**\n\nMissing properties and `undefined` values are treated as equal, but `null` is different:\n\n```typescript\nconst obj1 = { a: 1, b: undefined }\nconst obj2 = { a: 1 }\nconst obj3 = { a: 1, b: null }\n\nObject[equals](obj1, obj2) // true\nObject[equals](obj1, obj3) // false\n```\n\n**Prototype-less objects**\n\nObjects created with `Object.create(null)` work fine:\n\n```typescript\nconst a = Object.create(null)\na.prop = 'value'\n\nconst b = { prop: 'value' }\n\nObject[equals](a, b) // true\n```\n</details>\n\n<details>\n<summary><b>Arrays</b> — Element-by-element comparison.</summary>\n\nNested structures are compared deeply:\n\n```typescript\nconst arr1 = [1, 2, { key: 'value' }]\nconst arr2 = [1, 2, { key: 'value' }]\n\nObject[equals](arr1, arr2) // true\n```\n</details>\n\n<details>\n<summary><b>Maps & Sets</b> — Entry/element comparison with deep equality.</summary>\n\nValues and elements are compared deeply. Note that Map keys are compared by identity:\n\n```typescript\nconst map1 = new Map([['a', { id: 1 }], ['b', { id: 2 }]])\nconst map2 = new Map([['a', { id: 1 }], ['b', { id: 2 }]])\n\nconst set1 = new Set([1, { key: 'value' }])\nconst set2 = new Set([1, { key: 'value' }])\n\nObject[equals](map1, map2) // true\nObject[equals](set1, set2) // true\n```\n</details>\n\n<details>\n<summary><b>Functions</b> — Functions with identical string representation are equal.</summary>\n\n```typescript\nconst fn1 = () => 42\nconst fn2 = () => 42\n\nObject[equals](fn1, fn2) // true\n```\n\nNote: This compares the `.toString()` output, so functions with the same code but different names or closures may differ.\n</details>\n\n## Custom equality\n\nImplement the `equals` symbol (or `.equals()` method with global API):\n\n```typescript\nimport { equals } from '@a11d/equals'\n\nclass Person {\n\tconstructor(public name: string, public age: number) {}\n\n\t[equals](other: unknown): boolean {\n\t\treturn other instanceof Person\n\t\t\t&& this.name === other.name\n\t\t\t&& this.age === other.age\n\t}\n}\n```\n\n## Lit integration\n\nUse `hasChanged` to trigger re-renders only on structural changes:\n\n```typescript\nimport { hasChanged } from '@a11d/equals'\n\nclass MyComponent extends Component {\n\t@property({ type: Object, hasChanged })\n\tdata = { name: 'John', items: [1, 2, 3] }\n}\n```\n\nWithout this, Lit re-renders whenever you assign a new object reference, even if the content is identical.","readmeFilename":"README.md"}