@mr/object-identity@0.1.2
latest
maraisr/object-identityThis package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
64%
Published
a year ago (0.1.2)
object-identity 
A utility that provides a stable identity of an object
This is free to use software, but if you do like it, consider supporting me â¤ī¸
⥠Features
- â Intuitive
- đĒ Recursive/Circular support
- đ Performant â check the benchmarks.
- đĒļ Lightweight â a mere 387B and no dependencies.
đ Usage
import { identify } from 'object-identity'; // or import { identify } from 'https://deno.land/x/object_identity'; // ~> identity the object const id1 = identify({ a: new Set(['b', 'c', new Map([['d', 'e']])]) }); // ~> an entirely different object, but structurally the same const id2 = identify({ a: new Set(['b', 'c', new Map([['e', 'e']])]) }); // they should equal assert.toEqual(hashA, hashB);
đ¨ Benchmark
via the
/bench
directory with deno 1.41.3
â object-identity ~ 14,646,170 ops/sec Âą 0.10% â object-hash ~ 144,060 ops/sec Âą 0.01% â json-stable-stringify ~ 638,559 ops/sec Âą 0.01%
^
object-identity
is not as feature-full it's alternatives, specifically aroundfunction
values and other node builtins. So take this benchmark with a grain of salt, as it's only testing "json-like" payloads.
License
MIT Š Marais Rossouw
Add Package
deno add jsr:@mr/object-identity
Import symbol
import * as object_identity from "@mr/object-identity";
---- OR ----
Import directly with a jsr specifier
import * as object_identity from "jsr:@mr/object-identity";
Add Package
npx jsr add @mr/object-identity
Import symbol
import * as object_identity from "@mr/object-identity";
Add Package
yarn dlx jsr add @mr/object-identity
Import symbol
import * as object_identity from "@mr/object-identity";
Add Package
pnpm dlx jsr add @mr/object-identity
Import symbol
import * as object_identity from "@mr/object-identity";
Add Package
bunx jsr add @mr/object-identity
Import symbol
import * as object_identity from "@mr/object-identity";