@zkochan/pnpm
Version:
Fast, disk space efficient package manager
92 lines (91 loc) • 4.9 kB
JSON
{
"_args": [
[
{
"raw": "fast-safe-stringify@~1.1.0",
"scope": null,
"escapedName": "fast-safe-stringify",
"name": "fast-safe-stringify",
"rawSpec": "~1.1.0",
"spec": ">=1.1.0 <1.2.0",
"type": "range"
},
"/home/zkochan/src/pnpm/packages/pnpm/node_modules/bole"
]
],
"_from": "fast-safe-stringify@>=1.1.0 <1.2.0",
"_id": "fast-safe-stringify@1.1.13",
"_inCache": true,
"_location": "/fast-safe-stringify",
"_nodeVersion": "6.9.4",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/fast-safe-stringify-1.1.13.tgz_1490695569907_0.4146328771021217"
},
"_npmUser": {
"name": "matteo.collina",
"email": "hello@matteocollina.com"
},
"_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
"raw": "fast-safe-stringify@~1.1.0",
"scope": null,
"escapedName": "fast-safe-stringify",
"name": "fast-safe-stringify",
"rawSpec": "~1.1.0",
"spec": ">=1.1.0 <1.2.0",
"type": "range"
},
"_requiredBy": [
"/bole"
],
"_resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.1.13.tgz",
"_shasum": "a01e9cd9c9e491715c98a75a42d5f0bbd107ff76",
"_shrinkwrap": null,
"_spec": "fast-safe-stringify@~1.1.0",
"_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/bole",
"author": {
"name": "David Mark Clements"
},
"bugs": {
"url": "https://github.com/davidmarkclements/fast-safe-stringify/issues"
},
"dependencies": {},
"description": "Safely and quickly serialize JavaScript objects",
"devDependencies": {
"clone": "^2.1.0",
"fastbench": "^1.0.1",
"json-stringify-safe": "^5.0.1",
"standard": "^9.0.0",
"tap": "^10.0.0"
},
"directories": {},
"dist": {
"shasum": "a01e9cd9c9e491715c98a75a42d5f0bbd107ff76",
"tarball": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.1.13.tgz"
},
"gitHead": "4ba528f1267c9672273a23d73a9c15a89b1e6a26",
"homepage": "https://github.com/davidmarkclements/fast-safe-stringify#readme",
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "davidmarkclements",
"email": "huperekchuno@googlemail.com"
}
],
"name": "fast-safe-stringify",
"optionalDependencies": {},
"readme": "# fast-safe-stringify\n\nSafely and quickly serialize JavaScript objects\n\nDetects circular dependencies instead of throwing\n(as per usual `JSON.stringify` usage)\n\n## Usage\n\n```js\nvar safeStringify = require('fast-safe-stringify')\nvar o = {a: 1}\no.o = o\n\nconsole.log(safeStringify(o)) // '{\"a\":1,\"o\":\"[Circular]\"}'\nconsole.log(JSON.stringify(o)) //<-- throws\n```\n\n## Benchmarks\n\nThe [json-stringify-safe](http://npm.im/json-stringify-safe) module supplies similar functionality with more info and flexibility.\n\nAlthough not JSON, the core `util.inspect` method can be used for similar purposes (e.g. logging) and also handles circular references.\n\nHere we compare `fast-safe-stringify` with these alternatives:\n\n```\ninspectBench*10000: 179.608ms\njsonStringifySafeBench*10000: 30.099ms\nfastSafeStringifyBench*10000: 19.965ms\n\ninspectCircBench*10000: 220.763ms\njsonStringifyCircSafeBench*10000: 39.115ms\nfastSafeStringifyCircBench*10000: 29.444ms\n\ninspectDeepBench*10000: 2231.148ms\njsonStringifySafeDeepBench*10000: 880.177ms\nfastSafeStringifyDeepBench*10000: 230.209ms\n\ninspectDeepCircBench*10000: 2221.848ms\njsonStringifySafeDeepCircBench*10000: 922.314ms\nfastSafeStringifyDeepCircBench*10000: 236.024ms\n```\n\n## Protip\n\nWhether you're using `fast-safe-stringify` or `json-stringify-safe`\nif your use case consists of deeply nested objects without circular\nreferences the following pattern will give you best results:\n\n```js\nvar fastSafeStringify = require('fast-safe-stringify')\nfunction tryStringify (obj) {\n try { return JSON.stringify(obj) } catch (_) {}\n}\nvar str = tryStringify(deep) || fastSafeStringify(deep)\n```\n\nIf you're likely to be handling mostly shallow or one level nested objects,\nthis same pattern will degrade performance - it's entirely dependant on use case.\n\n## JSON.stringify options\n\nJSON.stringify's `replacer` and `space` options are not supported. Any value\nother than 0 for `space` halves the speed, and providing a replacer function\ncan result in a segfault. Given that the primary focus of this serializer is\nspeed, the trade offs for supporting these options are not desirable.\n\n## Acknowledgements\n\nSponsored by [nearForm](http://nearform.com)\n\n## License\n\nMIT\n\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/davidmarkclements/fast-safe-stringify.git"
},
"scripts": {
"test": "standard && tap test.js"
},
"typings": "index",
"version": "1.1.13"
}