···6677</samp>
8899-**A utility that provides a stable identity of an object**
99+**A tiny, fast utility that canonicalizes any value into a stable identity, for structurally
1010+equality.**
10111112<br>
1213<br>
···24252526## ⚡ Features
26272727-- ✅ **Intuitive**
2828-- 🌪 **Recursive/Circular support**
2929-- 🏎 **Performant** — check the [benchmarks](#-benchmark).
3030-- 🪶 **Lightweight** — a mere 387B and no
2828+- 🧬 **Canonical.** The same shape always produces the same id.
2929+- 🌀 **Deep and cycle-safe.** Handles nested objects, arrays, sets, maps, and circular references.
3030+- 🏎 **Fast.** See the [benchmarks](#-benchmark).
3131+- 🪶 **Tiny.** Around 436B minified and gzipped, with zero
3132 [dependencies](https://npm.anvaka.com/#/view/2d/object-identity/).
32333334## ⚙️ Install
···4041```ts
4142import { identify } from 'object-identity';
42434343-// ~> identity the object
4444-const id1 = identify({ a: new Set(['b', 'c', new Map([['d', 'e']])]) });
4545-// ~> an entirely different object, but structurally the same
4646-const id2 = identify({ a: new Set(['b', 'c', new Map([['e', 'e']])]) });
4444+// same shape, different key order, same id
4545+identify({ a: 1, b: 2 }) === identify({ b: 2, a: 1 }); // true
47464848-// they should equal
4949-assert.toEqual(hashA, hashB);
4747+// a plain object and an equivalent Map produce the same id
4848+identify({ a: 'b' }) === identify(new Map([['a', 'b']])); // true
4949+5050+// nesting, Sets, Dates, and RegExps are all supported
5151+const key = identify({ user: 7, filters: new Set(['active', 'new']) });
5052```
51535254## 💨 Benchmark