{"author":{"name":"tony_quetano@planttheidea.com"},"ava":{"babel":"inherit","failFast":true,"files":["test/*.js"],"require":["babel-register"],"source":["src/*.js"],"verbose":true},"bugs":{"url":"https://github.com/planttheidea/fast-stringify/issues"},"description":"A blazing fast stringifier that safely handles circular objects","devDependencies":{"ava":"^0.25.0","babel-cli":"^6.26.0","babel-eslint":"^8.2.3","babel-loader":"^7.1.4","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.6.1","babel-preset-minify":"^0.4.3","babel-preset-react":"^6.24.1","babel-preset-stage-2":"^6.24.1","babel-register":"^6.26.0","benchmark":"^2.1.4","decircularize":"^1.0.0","eslint":"^4.19.1","eslint-config-rapid7":"^2.11.1","eslint-friendly-formatter":"^4.0.1","eslint-loader":"^2.0.0","fast-json-stable-stringify":"^2.0.0","html-webpack-plugin":"^3.2.0","in-publish":"^2.0.0","json-cycle":"^1.3.0","json-stable-stringify":"^1.0.1","json-stringify-safe":"^5.0.1","nyc":"^12.0.1","optimize-js-plugin":"^0.0.4","react":"^16.3.2","react-dom":"^16.3.2","rollup":"^0.59.4","rollup-plugin-babel":"^3.0.4","rollup-plugin-node-resolve":"^3.3.0","rollup-plugin-uglify":"^4.0.0","sinon":"^5.0.7","webpack":"^4.8.1","webpack-cli":"^2.1.4","webpack-dev-server":"^3.1.4"},"homepage":"https://github.com/planttheidea/fast-stringify#readme","keywords":["stringify","fast","serialize","json"],"license":"MIT","main":"lib/index.js","module":"es/index.js","name":"fast-stringify","repository":{"type":"git","url":"git+https://github.com/planttheidea/fast-stringify.git"},"scripts":{"benchmark":"NODE_ENV=production BABEL_ENV=benchmark babel src --out-dir lib --no-comments && node benchmark/index.js","build":"NODE_ENV=production rollup -c","clean":"npm run clean:es && npm run clean:lib && npm run clean:dist","clean:dist":"rimraf dist","clean:es":"rimraf es","clean:lib":"rimraf lib","dev":"NODE_ENV=development webpack-dev-server --colors --progress --config=webpack/webpack.config.dev.js","dist":"npm run clean:dist && npm run build","lint":"NODE_ENV=test eslint src --max-warnings 0","lint:fix":"NODE_ENV=test eslint src --fix","prepublish":"if in-publish; then npm run prepublish:compile; fi","prepublish:compile":"npm run lint && npm run test:coverage && npm run transpile:lib && npm run transpile:es && npm run dist","start":"npm run dev","test":"NODE_PATH=. BABEL_ENV=test ava","test:coverage":"nyc npm test","test:watch":"npm test -- --watch","transpile:es":"npm run clean:es && BABEL_ENV=es babel src --out-dir es","transpile:lib":"npm run clean:lib && BABEL_ENV=lib babel src --out-dir lib"},"types":"index.d.ts","version":"1.0.0","gitHead":"072e30b33061308639a64fb94c63a55b47215a40","_id":"fast-stringify@1.0.0","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"planttheidea","email":"tony.quetano@planttheidea.com"},"dist":{"integrity":"sha512-x57BrosS9vRJAi7rynUOgVtsPFjyh4+EZkmLsKGg/jZCEdxr1x05bQaLVwH+Lbc31L9myZ/nW5RVPd+6PuGt3Q==","shasum":"c686de48ba3013069b525ccfc5c333fd693ddbd3","tarball":"http://registry-npm.ywwl.com/fast-stringify/download/fast-stringify-1.0.0.tgz","fileCount":14,"unpackedSize":24657,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbE8l4CRA9TVsSAnZWagAARaIQAJ6BM+1Zr723ANiCefmU\n9iVRCRioQRRYkFm523iqUp40F5aQOkkGzlpeToaJ4ltEkMG1LgwgQgN+ZtNg\npoCy8la+57tIY4x4WAF5SgH8WCx4sZDWYK4QUIAZVv3+BDVo5thlv07U54C8\nh7Nbasc1u+sK3G80IvhRCr6ZY8y2Hrx/tGX01HxiQlSiwlrjH8qZVwqTxCDX\n19Nw+bEpml111RZyZYK1RDzkj7gCmce0ehe9VP+STu9aLILpKyVfY4yrD7pW\nIRsIcz/4p9yYOvRvZJDY3SDjgTRbeyVK7F29QrnlQranwCaeiQwWaEHl3sw/\n5ZVAN65Uegnj/Tt3PwJSE2h/Kuu3R54tORw/R0kKc4cnsP8OQnf5EBQ5gmC2\nBbxVnU9ahcBOHDV0vE1SWhfEHviZk9G97wtNmzP5a1lmI7DTkMWplOBqs1Nu\nkyCkH3d5hxOP+rZuqfjNa9KJa2CzDJ1Bln9Yi2/jRkYeEH0Cbn5hhvUTbFNG\niu50PxsqMoIFmItbVHhOQhcjEopWpuRv2UiBLhRfV/k//mMpm9QVih4RFFz/\n2kIhDJzt5/zxzB7Rjr+CQLD9ttVvX9IehZJVCryhcNACgBzrnWDq2M5d0vNW\niz2VMzkq2vz5cEWlspRLyt+8JiEWH6ttCsOgZmbO1ynQv2uTFPS6pUq/xp2b\ne5TV\r\n=ehJ1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICdBVPEJQ4IeSDVxKwujtwepCcqMia+RAZa0cma/iC8nAiEAzp2a9i33rPeqaDqsKhBfxJFj7Brq+Vx0cHPyc2msQVU="}],"size":6980,"noattachment":false,"key":"/fast-stringify/-/fast-stringify-1.0.0.tgz"},"maintainers":[{"name":"planttheidea","email":"tony.quetano@planttheidea.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fast-stringify_1.0.0_1528023415032_0.6300186963418417"},"_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":1528023415134,"_cnpm_publish_time":1528023415134,"dist-tags":{"latest":"4.0.3","next":"4.0.0-beta.0"}}