{"author":{"name":"tony_quetano@planttheidea.com"},"browser":"dist/index.js","bugs":{"url":"https://github.com/planttheidea/fast-stringify/issues"},"description":"A blazing fast stringifier that safely handles circular objects","devDependencies":{"@babel/cli":"^7.5.0","@babel/core":"^7.5.0","@babel/plugin-proposal-class-properties":"^7.5.0","@babel/plugin-proposal-json-strings":"^7.2.0","@babel/plugin-transform-runtime":"^7.5.0","@babel/preset-env":"^7.5.0","@babel/preset-react":"^7.0.0","@babel/preset-typescript":"^7.3.3","@babel/runtime":"^7.5.0","@types/jest":"^24.0.15","@types/react":"^16.8.23","babel-eslint":"^10.0.2","babel-loader":"^8.0.6","babel-preset-minify":"^0.5.0","benchmark":"^2.1.4","decircularize":"^1.0.0","eslint":"^6.0.1","eslint-config-airbnb-base":"^13.2.0","eslint-friendly-formatter":"^4.0.1","eslint-loader":"^2.2.1","eslint-plugin-import":"^2.18.0","fast-json-stable-stringify":"^2.0.0","html-webpack-plugin":"^3.2.0","jest":"^24.8.0","json-cycle":"^1.3.0","json-stable-stringify":"^1.0.1","json-stringify-safe":"^5.0.1","react":"^16.8.6","react-dom":"^16.8.6","rollup":"^1.16.4","rollup-plugin-babel":"^4.3.3","rollup-plugin-terser":"^5.1.0","sinon":"^7.3.2","ts-jest":"^24.0.2","typescript":"^3.5.2","webpack":"^4.35.2","webpack-cli":"^3.3.5","webpack-dev-server":"^3.7.2"},"homepage":"https://github.com/planttheidea/fast-stringify#readme","keywords":["stringify","fast","serialize","json"],"license":"MIT","main":"dist/index.cjs.js","module":"dist/index.esm.js","name":"fast-stringify","repository":{"type":"git","url":"git+https://github.com/planttheidea/fast-stringify.git"},"scripts":{"benchmark":"npm run build && node benchmark/index.js","build":"NODE_ENV=production rollup -c","clean":"npm run clean:dist && npm run clean:mjs","clean:dist":"rimraf dist","clean:mjs":"rimraf mjs","copy:mjs":"node ./es-to-mjs.js","dev":"NODE_ENV=development webpack-dev-server --colors --progress --config=webpack/webpack.config.dev.js","dist":"npm run clean && npm run build && npm run copy:mjs","lint":"NODE_ENV=test eslint src/*.ts --max-warnings 0","lint:fix":"npm run lint -- --fix","prepublishOnly":"npm run lint && npm run typecheck && npm run test:coverage && npm run dist","release":"release-it","release:beta":"release-it --config=.release-it.beta.json","start":"npm run dev","test":"NODE_PATH=. BABEL_ENV=test jest","test:coverage":"npm test -- --coverage","test:watch":"npm test -- --watch","typecheck":"tsc src/* --noEmit"},"types":"index.d.ts","version":"2.0.0","gitHead":"df59c3809430b12ee3dadeeb2cba7a92af8fcb50","_id":"fast-stringify@2.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.2","dist":{"integrity":"sha512-+b+ki4C5K/tw+RmyiehpRzHjWmeqPb3Wn0whMsi+JPrYjzdapybfGejhCTblfLBErPMRSToYXDObawLG9BN78A==","shasum":"bb5dd243fce053e91d04f68e595405ca656167e4","tarball":"http://registry-npm.ywwl.com/fast-stringify/download/fast-stringify-2.0.0.tgz","fileCount":16,"unpackedSize":44939,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdHjWOCRA9TVsSAnZWagAAHIEP/3EIpvBr16e6iwGOJcew\nPRtFeYC8gx9QKg9nLQPH9YGJ8mGvGE4K4jJegdVIxfxoVnadrjBwJwsJl/Yc\nP+LJZvVnVOv63x7MpLVm8qBguCf5SEk51SF0JGaxAjh3dypC9YEtNKTT2TEM\ns2BSivX3YuE8saxSSVbrlmi6xRlMb5AmOysbGIdvWKxmZUD4rkRByFHleofN\nPCVxfou0r7zhrqOdXi5cZVTER97rAQeuCBziEHJPDT4wkLY4vB4JQjg8brCB\nv4/L1Wetgl4vSg2/4A7a/xgdSnf7/WFocPNN+PwtoKG1F7zzWw2gyjkd8Oeq\nduo2dpgohcto9+UDbP9XnqckBl4kg+MbVS4De1ayf2XTVB5hcSVZV2IvufTO\nX559LlNamsrzCEb1ZUDzxibJrRFDj9BRzeMvm1KcE1hSgvxQeHr/TTaJd5ef\nPg+uQVMynwBoDJ0Ek7GUsx9oida/hg9uLOYwnXLLiexN090kNHIVltppzHq/\nt+IQcxihuGGldowX5SmmRFq1MuvHlyqOnnXHu34kACAWshMxSuiZ+CNpPSIx\nCwbJsoQ1ZRVaeJ2h1aeImwMXUnB+zn6u7OWnEvE13Z/3ykW1MnsW3XhF+wI6\n1Q9vYLsvfheSk7bGs2WSj6QAW0BdVeSoBnNJBw7K/xYBcPpT6b1zazXWgdbd\nKvs8\r\n=0Ck4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGoE03V0WioIUmkS2w0ed4k0HEx8ixANiF2Kh4yMmxAXAiBfYSt59JjLTmp+otXpHqf1eRlZRlKDSFEvEjmdnr5GoA=="}],"size":8164,"noattachment":false,"key":"/fast-stringify/-/fast-stringify-2.0.0.tgz"},"maintainers":[{"name":"planttheidea","email":"tony.quetano@planttheidea.com"}],"_npmUser":{"name":"planttheidea","email":"tony.quetano@planttheidea.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fast-stringify_2.0.0_1562260877729_0.1231928193805496"},"_hasShrinkwrap":false,"readme":"# fast-stringify\n\nA tiny, [blazing fast](#benchmarks) stringifier that safely handles circular objects\n\n## Table of contents\n\n- [fast-stringify](#fast-stringify)\n  - [Table of contents](#Table-of-contents)\n  - [Summary](#Summary)\n  - [Usage](#Usage)\n      - [stringify](#stringify)\n  - [Importing](#Importing)\n  - [Benchmarks](#Benchmarks)\n      - [Simple objects](#Simple-objects)\n      - [Complex objects](#Complex-objects)\n      - [Circular objects](#Circular-objects)\n      - [Special objects](#Special-objects)\n  - [Development](#Development)\n\n## Summary\n\nThe fastest way to stringify an object will always be the native `JSON.stringify`, but it does not support circular objects out of the box. If you need to stringify objects that have circular references, `fast-stringify` is there for you! It maintains a very similar API to the native `JSON.stringify`, and aims to be the most performant stringifier that handles circular references.\n\n## Usage\n\n```javascript\nimport stringify from 'fast-stringify';\n\nconst object = {\n  foo: 'bar',\n  deeply: {\n    recursive: {\n      object: {},\n    },\n  },\n};\n\nobject.deeply.recursive.object = object.deeply.recursive;\n\nconsole.log(stringify(object));\n// {\"foo\":\"bar\",\"deeply\":{\"recursive\":{\"object\":\"[ref=.deeply.recursive]\"}}}\n```\n\n#### stringify\n\n```ts\ntype StandardReplacer = (key: string, value: any) => any;\ntype CircularReplacer = (key: string, value: any, referenceKey: string) => any;\n\nfunction stringify(\n  value: any,\n  replacer?: StandardReplacer,\n  indent?: number,\n  circularReplacer: CircularReplacer,\n): string;\n```\n\nStringifies the object passed based on the parameters you pass. The only required value is the `object`. The additional parameters passed will customize how the string is compiled.\n\n- `value` => the value to stringify\n- `replacer` => function to customize how the non-circular value is stringified (see [the documentation for JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) for more details)\n- `indent` => number of spaces to indent the stringified object for pretty-printing (see [the documentation for JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) for more details)\n- `circularReplacer` => function to customize how the circular value is stringified (defaults to `[ref=##]` where `##` is the `referenceKey`)\n  - `referenceKey` is a dot-separated key list reflecting the nested key the object was originally declared at\n\n## Importing\n\n```javascript\n// ESM in browsers\nimport stringify from 'fast-stringify';\n\n// ESM in NodeJS\nimport stringify from 'fast-stringify/mjs';\n\n// CommonJS\nconst stringify = require('fast-stringify');\n```\n\n## Benchmarks\n\n#### Simple objects\n\n_Small number of properties, all values are primitives_\n\n|                            | Operations / second | Relative margin of error |\n| -------------------------- | ------------------- | ------------------------ |\n| **fast-stringify**         | **598,072**         | **0.59%**                |\n| fast-json-stable-stringify | 339,082             | 0.86%                    |\n| json-stringify-safe        | 333,447             | 0.46%                    |\n| json-stable-stringify      | 255,619             | 0.71%                    |\n| json-cycle                 | 194,553             | 0.60%                    |\n| decircularize              | 141,821             | 1.35%                    |\n\n#### Complex objects\n\n_Large number of properties, values are a combination of primitives and complex objects_\n\n|                            | Operations / second | Relative margin of error |\n| -------------------------- | ------------------- | ------------------------ |\n| **fast-stringify**         | **97,559**          | **0.32%**                |\n| json-stringify-safe        | 59,948              | 0.44%                    |\n| fast-json-stable-stringify | 57,656              | 1.14%                    |\n| json-cycle                 | 51,892              | 0.59%                    |\n| json-stable-stringify      | 39,180              | 1.01%                    |\n| decircularize              | 27,047              | 0.84%                    |\n\n#### Circular objects\n\n_Objects that deeply reference themselves_\n\n|                                            | Operations / second | Relative margin of error |\n| ------------------------------------------ | ------------------- | ------------------------ |\n| **fast-stringify**                         | **87,030**          | **0.51%**                |\n| json-stringify-safe                        | 56,329              | 0.49%                    |\n| json-cycle                                 | 48,116              | 0.77%                    |\n| decircularize                              | 25,240              | 0.68%                    |\n| fast-json-stable-stringify (not supported) | 0                   | 0.00%                    |\n| json-stable-stringify (not supported)      | 0                   | 0.00%                    |\n\n#### Special objects\n\n_Custom constructors, React components, etc_\n\n|                            | Operations / second | Relative margin of error |\n| -------------------------- | ------------------- | ------------------------ |\n| **fast-stringify**         | **24,250**          | **0.38%**                |\n| json-stringify-safe        | 19,526              | 0.52%                    |\n| json-cycle                 | 18,433              | 0.74%                    |\n| fast-json-stable-stringify | 18,202              | 0.73%                    |\n| json-stable-stringify      | 13,041              | 0.87%                    |\n| decircularize              | 9,175               | 0.82%                    |\n\n## Development\n\nStandard practice, clone the repo and `npm i` to get the dependencies. The following npm scripts are available:\n\n- `benchmark` => run benchmark tests against other equality libraries\n- `build` => build dist files with `rollup`\n- `clean` => run `clean:dist` and `clean:mjs` scripts\n- `clean:dist` => run `rimraf` on the `dist` folder\n- `clean:mjs` => run `rimraf` on the `mjs` folder\n- `copy:mjs` => copy and transform the ESM file generated by `dist` to be consumable as an `.mjs` file\n- `dev` => start webpack playground App\n- `dist` => run `clean`, `build`, and `copy:mjs` scripts\n- `lint` => run ESLint on all files in `src` folder (also runs on `dev` script)\n- `lint:fix` => run `lint` script, but with auto-fixer\n- `prepublishOnly` => run `lint`, `typecheck`, `test:coverage`, and `dist` scripts\n- `release` => run `release-it` for standard versions (expected to be installed globally)\n- `release:beta` => run `release-it` for beta versions (expected to be installed globally)\n- `start` => run `dev`\n- `test` => run Jest with NODE_ENV=test on all files in `__tests__` folder\n- `test:coverage` => run same script as `test` with code coverage calculation\n- `test:watch` => run same script as `test` but keep persistent watcher\n- `typecheck` => run TypeScript types validation\n","publish_time":1562260877980,"_cnpm_publish_time":1562260877980,"dist-tags":{"latest":"4.0.3","next":"4.0.0-beta.0"}}