{"_id":"stable-hash","_rev":"8-62d0e4ec3e241f9bccf8047378dc630e","name":"stable-hash","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.1":{"name":"stable-hash","version":"0.0.1","author":{"name":"Shu Ding"},"license":"MIT","_id":"stable-hash@0.0.1","maintainers":[{"name":"quietshu","email":"ds303077135@gmail.com"}],"homepage":"https://github.com/shuding/stable-hash#readme","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"dist":{"shasum":"c7b079724ca04272dcf2ff314eb16a89aba25ca3","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.1.tgz","fileCount":3,"integrity":"sha512-HAUb9aBnn6t8qLKmZ+4roPtDfeLmJhorckQFnz8jsFBuHaII2CmsPU9pI0UXV18PUUcOaFEYCWYtlwQbfUvXWQ==","signatures":[{"sig":"MEQCIHaWLfAR4jPtoRd1nQETtQ2GBvmxLWS2ulB9Y06wz5xOAiBteNXDvioXqYIy3Y4CHAtPUzPlz//fJRu7bGRWA9w2yw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5630,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQ9w/CRA9TVsSAnZWagAATScP/jZYmewaoJYcOKiTweHQ\nt+FLB4jUZ+9CpbTc56f3W+Yl0zdq2UXsKDrV0LTOYOojgG88WfY/CPbc+POc\nq+bv7Ll6pzkG31v/KfDpaAOPOE6z9RpB86z5uC47VRAmdUxTAETxnQFqctl/\njKf4Styjx6taKaBnHGdv9bg1TDvL5D1bZslCUATzZJ+isr7V+XviSpJVAPJE\n1Nu+RKFhkFsMSfmIknOsDFMQ2IatbSakrfj3m44IlxzJg/S0cIEMecaQTIes\npHS1es0IIzmLKzquWtFxfzxz1frb3rFVgaTY5rATiB71wNmDFe2qYFVbr/V6\nmLGeTiEaq2PwUA2RXGQwOt36KmchZXf7CnS8jxseZeumW+IoDS8GTpmJ8cuY\nDaf1kqEnz7dDRyf1t264Zvk9WTeIJ4H8AYLvWw+1RQzbSZaJCPDtQUwnBFSG\n4y0LVTi1MdXkY0OIPBRs2eRAl7C/aR69KpPpV5EdFrh2EQhVdeYRQ1TIG2li\nehCdPxWAT7WsDci8cfx/Ignrsbm72yHc1urQxDoQntWKE9HBIvGdeDlct3cI\nN2CB+tk2amqjYrvxTy3NSnCV0PIla/pYOGBrgr48jWHwe8KmDNR8v0+gcqF7\nTAH0RCYhwOnzbur97ZOkL22TFJ2jQh6+SSh7UOZU3JkIRtEkcKPzMdcknpjp\nmgCO\r\n=9lut\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"b2769b2943dc23f40aee2f8d470b0cb96160f4e3","scripts":{"build":"yarn build:mjs && yarn build:cjs","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs"},"_npmUser":{"name":"quietshu","email":"ds303077135@gmail.com"},"prettier":{"semi":false},"repository":{"url":"git+https://github.com/shuding/stable-hash.git","type":"git"},"_npmVersion":"7.20.3","description":"Stable JS value hash.","directories":{},"_nodeVersion":"14.16.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.12.28"},"_npmOperationalInternal":{"tmp":"tmp/stable-hash_0.0.1_1631837247742_0.31529162882147954","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"stable-hash","version":"0.0.2","author":{"name":"Shu Ding"},"license":"MIT","_id":"stable-hash@0.0.2","maintainers":[{"name":"quietshu","email":"ds303077135@gmail.com"}],"homepage":"https://github.com/shuding/stable-hash#readme","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"dist":{"shasum":"a909deaa5b9d430b100ca0a10132a533f2665e94","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.2.tgz","fileCount":4,"integrity":"sha512-tPwQ3c1rLIwbJpq59duoznegEbmgfV630C2n4R4G96LKBFljgK8j+O9AxjqB6cAzu4gE7s4pByrLWtZel8E+Mg==","signatures":[{"sig":"MEUCIQCZMZ9G8oub07+TAc4rwuBp/i6XUbZCvrUxKIx+VrK+RAIgZDctFWwoSZ7x2UkhrnMf7bSxzgYJ1i9pB20KxC1TkLg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4901,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh277KCRA9TVsSAnZWagAAMWoP/3dvUPtLErzEcmYK7xfm\n5jqlVMDL1Fbm0gY77DP8nDH67v/JVb3y1fZq8SRdIb+MvdcU7Z6wG1C/D5HC\n08h9MnazX8WVqidHON3iQtpk7HTPAXgevg86lbJOwyY6YAEgchJ3Z6w6wxpT\nIsyN0u78W+4aR5wQ1fLYChWSyuPi7u2L4AQkDT1933gMlzn61KREPJ5pXLFr\n1Sy23NJ4QhBSR1ktiUY+78vuabc/t8cS7dKx7St/jNaq1v4VMyzaWgIU7FOl\nfbZzd1DqHqjZh3wYeFc07sa4df8/RVOtZHpupEi3uI32/TtTn6kx1Zmq1aNE\nyoZpdoq11XkOzAuu8N7GFLfKheCZpwFk7aHdq8bqXkSykl+DceJmzJCIDoe7\nTy4rTL4xWx5jge/iAmExEWXNi9EwrQRguA4icv0xG4UYok09HJS45Q4MPsyU\n4eK1MAwQ5TmSosOilIODSE4oCdCGzGQiCglTf06px9YiFKMaaNygPynZlbyc\nl64BfI+kgr3/vHPbg1w6NOB8lH0YxjTtZ2vUZGyQxq2ovD+vDOAIHlMuulvF\nGwHDdMbZ5ovYN8a4mUSyZKLMkOGUWwjkgmhImI2OvwROB+TXMSXxY309QLpd\nQ/tgMHnjRlFFD25GKEOc4+Mfgjj4RVfsxNraWQvP1NTVimQuiNJvVI51fhMe\noLSV\r\n=masI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","module":"./dist/index.mjs","gitHead":"65b4e97f062e638074879525ceb21b5f25ddc280","scripts":{"build":"yarn build:mjs && yarn build:cjs","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs"},"_npmUser":{"name":"quietshu","email":"ds303077135@gmail.com"},"prettier":{"semi":false},"repository":{"url":"git+https://github.com/shuding/stable-hash.git","type":"git"},"_npmVersion":"7.20.3","description":"Stable JS value hash.","directories":{},"_nodeVersion":"14.16.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.12.28"},"_npmOperationalInternal":{"tmp":"tmp/stable-hash_0.0.2_1631886993883_0.017489791433481505","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"stable-hash","version":"0.0.3","author":{"name":"Shu Ding"},"license":"MIT","_id":"stable-hash@0.0.3","maintainers":[{"name":"quietshu","email":"g@shud.in"}],"homepage":"https://github.com/shuding/stable-hash#readme","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"dist":{"shasum":"0078583e684d56ca0ece08f7c588b19f88955698","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.3.tgz","fileCount":5,"integrity":"sha512-c63fvNCQ7ip1wBfPv54MflMA5L6OE5J0p6Fg13IpKft4JAFoNal8+s/jtJ8PibrwqXm4onnbeQsADs8k0NQGUA==","signatures":[{"sig":"MEUCIF1RJZ6pfGLjaPXP1sW0jZlXlMh5JvycOf3o5Si/pzGPAiEA4gjcjxdkvIjgmBgbmTyKqc/0lufXeWugGgK6BVdxQ4c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5540,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjm063ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpywQ/+JjG8T785YQvGVSoKvIRBwdLopWez+fV3MtJuiiYPtqA0libi\r\nbyZ5viHEu+blG5XKylFDjsDKTBOogl0T76wSnNubbxBuf1+HejMaGh8ExK70\r\nxMcFYHXmCFMjk8uwxok/nVi35Oihgm/xAkxWtTyDSX/wpnqWNAth5YBqwbma\r\nc/uHg4k6Ym6mUUiijty/KTNBYQPQqgO6puqRXrye+917TJ9+rsUinhf7m5UJ\r\nZiRxg02/6l6LDtHuTJkbDHpF8DZJiJL3zgoOPlCoHSdglFr9MM+aXFb2gUtq\r\nWKzshaM2pIcmEccj9U7fU/xnDjpKy9oRfk413GXUxDWNkv5h5RIRxy8eTwBg\r\nr9V3nczVcsoHhFnVI+m1affprOzgic3d7Z+wE2jQxGEBB072vTpyEOqiU/7s\r\nm9hjaEwpXRWhnkT45NQSDZNoP2nOUyiO3EXFeWYhfzqz5YdTLsvdVF04DyIF\r\nCrE4XDAKVQi+l0Cu5798QjLt4tI750i5XTZND/ttotA1V/YDW7tjxupSSssf\r\nL3pskbXhWdNeOLj3ndEAJ+XYEgRLt1WqY1GkWdH1Rn9q7llmjfuUBEeiizRs\r\nEl6YuooMPp2fUGdRYQurp7Ku+tOQTFMbNdq3YA40TXpDIlY+du682rJAjvFI\r\nvhgvhFzDAgUBGWi+xlHiBqqi0BE78HuJtOk=\r\n=XsVO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{"import":"./dist/index.mjs","require":"./dist/index.js"},"gitHead":"be2acc38568ab553cdb79485676b71ac1db00431","scripts":{"test":"jest","build":"yarn build:mjs && yarn build:cjs && yarn build:types","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs","build:types":"tsc --emitDeclarationOnly --declaration -p tsconfig.build.json"},"_npmUser":{"name":"quietshu","email":"g@shud.in"},"prettier":{"semi":false},"repository":{"url":"git+https://github.com/shuding/stable-hash.git","type":"git"},"_npmVersion":"7.20.1","description":"Stable JS value hash.","directories":{},"_nodeVersion":"16.14.2","_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","esbuild":"^0.12.28","flattie":"^1.1.0","ts-jest":"^28.0.5","hash-obj":"^4.0.0","prettier":"^2.7.1","nanobench":"^2.1.1","base64-url":"^2.3.3","typescript":"^4.7.4","@types/jest":"^28.1.3","json-stringify-deterministic":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/stable-hash_0.0.3_1671122615789_0.7831061515878903","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"stable-hash","version":"0.0.4","author":{"name":"Shu Ding"},"license":"MIT","_id":"stable-hash@0.0.4","maintainers":[{"name":"quietshu","email":"g@shud.in"}],"homepage":"https://github.com/shuding/stable-hash#readme","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"dist":{"shasum":"55ae7dadc13e4b3faed13601587cec41859b42f7","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.4.tgz","fileCount":5,"integrity":"sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==","signatures":[{"sig":"MEUCIQCSqLxFmXEwvIYovKVKjOLog+AKWlIr4Yc/QWRCs88TJgIgYbnV92ZpafxBw9O0ViQS7NaKI026S9VEKiEoUoWnsjQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5463},"main":"./dist/index.js","_from":"file:stable-hash-0.0.4.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"scripts":{"test":"jest","build":"yarn build:mjs && yarn build:cjs && yarn build:types","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs","build:types":"tsc --emitDeclarationOnly --declaration -p tsconfig.build.json"},"_npmUser":{"name":"quietshu","email":"g@shud.in"},"prettier":{"semi":false},"_resolved":"/private/var/folders/zr/9p6mp0r13fn3s9fxzxp33_280000gn/T/efbcc7f038e7d3415427d1fb0c552b52/stable-hash-0.0.4.tgz","_integrity":"sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==","repository":{"url":"git+https://github.com/shuding/stable-hash.git","type":"git"},"_npmVersion":"9.6.6","description":"Stable JS value hash.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","esbuild":"^0.12.28","flattie":"^1.1.0","ts-jest":"^28.0.5","hash-obj":"^4.0.0","prettier":"^2.7.1","nanobench":"^2.1.1","base64-url":"^2.3.3","typescript":"^4.7.4","@types/jest":"^28.1.3","json-stringify-deterministic":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/stable-hash_0.0.4_1707852273433_0.5170144516727231","host":"s3://npm-registry-packages"}},"0.0.5":{"name":"stable-hash","version":"0.0.5","author":{"name":"Shu Ding"},"license":"MIT","_id":"stable-hash@0.0.5","maintainers":[{"name":"quietshu","email":"g@shud.in"}],"homepage":"https://github.com/shuding/stable-hash#readme","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"dist":{"shasum":"94e8837aaeac5b4d0f631d2972adef2924b40269","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz","fileCount":5,"integrity":"sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==","signatures":[{"sig":"MEUCICynWAKZ6r5vHz+pa0YqsT1C6DePhkxfMB4rlW1mIakmAiEAx3t/4LrKZFzWSjHrdq1f5YPNLyzMd6s8cRkXrC65nDg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5596},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"gitHead":"1b314f2cc3e9449bc8d49e417670175cf9afd42a","scripts":{"test":"jest","build":"pnpm build:mjs && pnpm build:cjs && pnpm build:types","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs","build:types":"tsc --emitDeclarationOnly --declaration -p tsconfig.build.json"},"_npmUser":{"name":"quietshu","email":"g@shud.in"},"prettier":{"semi":false},"repository":{"url":"git+https://github.com/shuding/stable-hash.git","type":"git"},"_npmVersion":"10.9.2","description":"Stable JS value hash.","directories":{},"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.15.0","devDependencies":{"jest":"^28.1.1","esbuild":"^0.12.28","flattie":"^1.1.0","ts-jest":"^28.0.5","hash-obj":"^4.0.0","prettier":"^2.7.1","nanobench":"^2.1.1","base64-url":"^2.3.3","typescript":"^4.7.4","@types/jest":"^28.1.3","json-stringify-deterministic":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/stable-hash_0.0.5_1741852309757_0.4744864510781359","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"stable-hash","version":"0.0.6","description":"Stable JS value hash.","repository":{"type":"git","url":"git+https://github.com/shuding/stable-hash.git"},"author":{"name":"Shu Ding"},"license":"MIT","packageManager":"pnpm@9.15.0","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"},"scripts":{"build:mjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --out-extension:.js=.mjs","build:cjs":"esbuild src/index.ts --minify --target=es6 --outdir=dist --format=cjs","build:types":"tsc --emitDeclarationOnly --declaration -p tsconfig.build.json","build":"pnpm build:mjs && pnpm build:cjs && pnpm build:types","test":"jest"},"devDependencies":{"@types/jest":"^28.1.3","@types/node":"^22.14.0","base64-url":"^2.3.3","esbuild":"^0.12.28","flattie":"^1.1.0","hash-obj":"^4.0.0","jest":"^28.1.1","json-stringify-deterministic":"^1.0.7","nanobench":"^2.1.1","prettier":"^2.7.1","ts-jest":"^28.0.5","typescript":"^4.7.4"},"prettier":{"semi":false},"_id":"stable-hash@0.0.6","gitHead":"071d855e20d5ef4958610a3e44dbeb936a3411ca","bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"homepage":"https://github.com/shuding/stable-hash#readme","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-0afH4mobqTybYZsXImQRLOjHV4gvOW+92HdUIax9t7a8d9v54KWykEuMVIcXhD9BCi+w3kS4x7O6fmZQ3JlG/g==","shasum":"7dd2cb7c71c2526b0d089b6bf0d1fcef38a6f97e","tarball":"https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.6.tgz","fileCount":5,"unpackedSize":5637,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDvPhV3BYGgzCcMdgXs15dXkUDpfkRMOzHy6qfsiPF6MwIhAKZpy1hJuP03/U5LvGC+qutE4R1+kKmxEecFaSThBci5"}]},"_npmUser":{"name":"quietshu","email":"g@shud.in"},"directories":{},"maintainers":[{"name":"quietshu","email":"g@shud.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stable-hash_0.0.6_1748869728011_0.6696344339122868"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-17T00:07:27.742Z","modified":"2025-06-02T13:08:48.374Z","0.0.1":"2021-09-17T00:07:27.962Z","0.0.2":"2021-09-17T13:56:34.073Z","0.0.3":"2022-12-15T16:43:35.926Z","0.0.4":"2024-02-13T19:24:33.587Z","0.0.5":"2025-03-13T07:51:49.916Z","0.0.6":"2025-06-02T13:08:48.184Z"},"bugs":{"url":"https://github.com/shuding/stable-hash/issues"},"author":{"name":"Shu Ding"},"license":"MIT","homepage":"https://github.com/shuding/stable-hash#readme","repository":{"type":"git","url":"git+https://github.com/shuding/stable-hash.git"},"description":"Stable JS value hash.","maintainers":[{"name":"quietshu","email":"g@shud.in"}],"readme":"# stable-hash\n\nA tiny and fast (481b [unpkg](https://unpkg.com/stable-hash@0.0.3/dist/index.mjs)) lib for \"stably hashing\" a JavaScript value. Originally created for [SWR](https://github.com/vercel/swr).\n\nIt's similar to `JSON.stringify(value)`, but:\n1. Supports any JavaScript value (BigInt, NaN, Symbol, function, class, ...)\n2. Sorts object keys (stable)\n3. Supports circular objects\n\n## Use\n\n```bash\nyarn add stable-hash\n```\n\n```js\nimport hash from 'stable-hash'\n\nhash(anyJavaScriptValueHere) // returns a string\n```\n\n## Examples\n\n### Primitive Value\n\n```js\nhash(1)\nhash('foo')\nhash(true)\nhash(undefined)\nhash(null)\nhash(NaN)\n```\n\nBigInt:\n\n```js\nhash(1) === hash(1n)\nhash(1) !== hash(2n)\n```\n\nSymbol:\n\n```js\nhash(Symbol.for('foo')) === hash(Symbol.for('foo'))\nhash(Symbol.for('foo')) === hash(Symbol('foo'))\nhash(Symbol('foo')) === hash(Symbol('foo'))\nhash(Symbol('foo')) !== hash(Symbol('bar'))\n```\n\n_Since Symbols cannot be serialized, stable-hash simply uses its description as the hash._\n\n### Regex\n\n```js\nhash(/foo/) === hash(/foo/)\nhash(/foo/) !== hash(/bar/)\n```\n\n### Date\n\n```js\nhash(new Date(1)) === hash(new Date(1))\n```\n\n### Array\n\n```js\nhash([1, '2', [new Date(3)]]) === hash([1, '2', [new Date(3)]])\nhash([1, 2]) !== hash([2, 1])\n```\n\nCircular:\n\n```js\nconst foo = []\nfoo.push(foo)\nhash(foo) === hash(foo)\n```\n\n### Object\n\n```js\nhash({ foo: 'bar' }) === hash({ foo: 'bar' })\nhash({ foo: { bar: 1 } }) === hash({ foo: { bar: 1 } })\n```\n\nStable:\n\n```js\nhash({ a: 1, b: 2, c: 3 }) === hash({ c: 3, b: 2, a: 1 })\n```\n\nCircular:\n\n```js\nconst foo = {}\nfoo.foo = foo\nhash(foo) === hash(foo)\n```\n\n### Function, Class, Set, Map, Buffer...\n\n`stable-hash` guarantees reference consistency (`===`) for objects that the constructor isn't `Object`.\n\n```js\nconst foo = () => {}\nhash(foo) === hash(foo)\nhash(foo) !== hash(() => {})\n```\n\n```js\nclass Foo {}\nhash(Foo) === hash(Foo)\nhash(Foo) !== hash(class {})\n```\n\n```js\nconst foo = new Set([1])\nhash(foo) === hash(foo)\nhash(foo) !== hash(new Set([1]))\n```\n\n## Notes\n\nThis function does something similar to `JSON.stringify`, but more than it. It doesn't generate a secure checksum, which usually has a fixed length and is hard to be reversed. With `stable-hash` it's still possible to get the original data. Also, the output might include any charaters, not just alphabets and numbers like other hash algorithms. So:\n\n- Use another encoding layer on top of it if you want to display the output. \n- Use another crypto layer on top of it if you want to have a secure and fixed length hash.\n\n```js\nimport crypto from 'crypto'\nimport hash from 'stable-hash'\n\nconst weakHash = hash(anyJavaScriptValueHere)\nconst encodedHash = Buffer.from(weakHash).toString('base64')\nconst safeHash = crypto.createHash('MD5').update(weakHash).digest('hex')\n```\n\nAlso, the consistency of this lib is sometimes guaranteed by the singularity of the WeakMap instance. So it might not generate the consistent results when running in different runtimes, e.g. server/client or parent/worker scenarios.\n\n## License\n\nCreated by Shu Ding. Released under the MIT License.\n","readmeFilename":"README.md"}