| 1 |
{ |
| 2 |
"_id": "json-stable-stringify-without-jsonify", |
| 3 |
"_rev": "1-b6c432adf63117a59ec267c492be44cc", |
| 4 |
"name": "json-stable-stringify-without-jsonify", |
| 5 |
"description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies", |
| 6 |
"dist-tags": { |
| 7 |
"latest": "1.0.1" |
| 8 |
}, |
| 9 |
"versions": { |
| 10 |
"1.0.1": { |
| 11 |
"name": "json-stable-stringify-without-jsonify", |
| 12 |
"version": "1.0.1", |
| 13 |
"description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies", |
| 14 |
"main": "index.js", |
| 15 |
"dependencies": {}, |
| 16 |
"devDependencies": { |
| 17 |
"tape": "~1.0.4" |
| 18 |
}, |
| 19 |
"scripts": { |
| 20 |
"test": "tape test/*.js" |
| 21 |
}, |
| 22 |
"testling": { |
| 23 |
"files": "test/*.js", |
| 24 |
"browsers": [ |
| 25 |
"ie/8..latest", |
| 26 |
"ff/5", |
| 27 |
"ff/latest", |
| 28 |
"chrome/15", |
| 29 |
"chrome/latest", |
| 30 |
"safari/latest", |
| 31 |
"opera/latest" |
| 32 |
] |
| 33 |
}, |
| 34 |
"repository": { |
| 35 |
"type": "git", |
| 36 |
"url": "git://github.com/samn/json-stable-stringify.git" |
| 37 |
}, |
| 38 |
"homepage": "https://github.com/samn/json-stable-stringify", |
| 39 |
"keywords": [ |
| 40 |
"json", |
| 41 |
"stringify", |
| 42 |
"deterministic", |
| 43 |
"hash", |
| 44 |
"sort", |
| 45 |
"stable" |
| 46 |
], |
| 47 |
"author": { |
| 48 |
"name": "James Halliday", |
| 49 |
"email": "[email protected]", |
| 50 |
"url": "http://substack.net" |
| 51 |
}, |
| 52 |
"license": "MIT", |
| 53 |
"gitHead": "c0b3c36d976c54e31a814c492cd1c2557a4d3758", |
| 54 |
"bugs": { |
| 55 |
"url": "https://github.com/samn/json-stable-stringify/issues" |
| 56 |
}, |
| 57 |
"_id": "[email protected]", |
| 58 |
"_shasum": "9db7b59496ad3f3cfef30a75142d2d930ad72651", |
| 59 |
"_from": ".", |
| 60 |
"_npmVersion": "3.10.9", |
| 61 |
"_nodeVersion": "7.2.1", |
| 62 |
"_npmUser": { |
| 63 |
"name": "samn", |
| 64 |
"email": "[email protected]" |
| 65 |
}, |
| 66 |
"dist": { |
| 67 |
"shasum": "9db7b59496ad3f3cfef30a75142d2d930ad72651", |
| 68 |
"tarball": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" |
| 69 |
}, |
| 70 |
"maintainers": [ |
| 71 |
{ |
| 72 |
"name": "samn", |
| 73 |
"email": "[email protected]" |
| 74 |
} |
| 75 |
], |
| 76 |
"_npmOperationalInternal": { |
| 77 |
"host": "packages-12-west.internal.npmjs.com", |
| 78 |
"tmp": "tmp/json-stable-stringify-without-jsonify-1.0.1.tgz_1481839233500_0.5462748887948692" |
| 79 |
}, |
| 80 |
"directories": {} |
| 81 |
} |
| 82 |
}, |
| 83 |
"readme": "# json-stable-stringify\n\nThis is the same as https://github.com/substack/json-stable-stringify but it doesn't depend on libraries without licenses (jsonify).\n\ndeterministic version of `JSON.stringify()` so you can get a consistent hash\nfrom stringified results\n\nYou can also pass in a custom comparison function.\n\n[](https://ci.testling.com/substack/json-stable-stringify)\n\n[](http://travis-ci.org/substack/json-stable-stringify)\n\n# example\n\n``` js\nvar stringify = require('json-stable-stringify');\nvar obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };\nconsole.log(stringify(obj));\n```\n\noutput:\n\n```\n{\"a\":3,\"b\":[{\"x\":4,\"y\":5,\"z\":6},7],\"c\":8}\n```\n\n# methods\n\n``` js\nvar stringify = require('json-stable-stringify')\n```\n\n## var str = stringify(obj, opts)\n\nReturn a deterministic stringified string `str` from the object `obj`.\n\n## options\n\n### cmp\n\nIf `opts` is given, you can supply an `opts.cmp` to have a custom comparison\nfunction for object keys. Your function `opts.cmp` is called with these\nparameters:\n\n``` js\nopts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue })\n```\n\nFor example, to sort on the object key names in reverse order you could write:\n\n``` js\nvar stringify = require('json-stable-stringify');\n\nvar obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };\nvar s = stringify(obj, function (a, b) {\n return a.key < b.key ? 1 : -1;\n});\nconsole.log(s);\n```\n\nwhich results in the output string:\n\n```\n{\"c\":8,\"b\":[{\"z\":6,\"y\":5,\"x\":4},7],\"a\":3}\n```\n\nOr if you wanted to sort on the object values in reverse order, you could write:\n\n```\nvar stringify = require('json-stable-stringify');\n\nvar obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 };\nvar s = stringify(obj, function (a, b) {\n return a.value < b.value ? 1 : -1;\n});\nconsole.log(s);\n```\n\nwhich outputs:\n\n```\n{\"d\":6,\"c\":5,\"b\":[{\"z\":3,\"y\":2,\"x\":1},9],\"a\":10}\n```\n\n### space\n\nIf you specify `opts.space`, it will indent the output for pretty-printing.\nValid values are strings (e.g. `{space: \\t}`) or a number of spaces\n(`{space: 3}`).\n\nFor example:\n\n```js\nvar obj = { b: 1, a: { foo: 'bar', and: [1, 2, 3] } };\nvar s = stringify(obj, { space: ' ' });\nconsole.log(s);\n```\n\nwhich outputs:\n\n```\n{\n \"a\": {\n \"and\": [\n 1,\n 2,\n 3\n ],\n \"foo\": \"bar\"\n },\n \"b\": 1\n}\n```\n\n### replacer\n\nThe replacer parameter is a function `opts.replacer(key, value)` that behaves\nthe same as the replacer\n[from the core JSON object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_native_JSON#The_replacer_parameter).\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install json-stable-stringify\n```\n\n# license\n\nMIT\n", |
| 84 |
"maintainers": [ |
| 85 |
{ |
| 86 |
"name": "samn", |
| 87 |
"email": "[email protected]" |
| 88 |
} |
| 89 |
], |
| 90 |
"time": { |
| 91 |
"modified": "2016-12-15T22:00:35.805Z", |
| 92 |
"created": "2016-12-15T22:00:35.805Z", |
| 93 |
"1.0.1": "2016-12-15T22:00:35.805Z" |
| 94 |
}, |
| 95 |
"homepage": "https://github.com/samn/json-stable-stringify", |
| 96 |
"keywords": [ |
| 97 |
"json", |
| 98 |
"stringify", |
| 99 |
"deterministic", |
| 100 |
"hash", |
| 101 |
"sort", |
| 102 |
"stable" |
| 103 |
], |
| 104 |
"repository": { |
| 105 |
"type": "git", |
| 106 |
"url": "git://github.com/samn/json-stable-stringify.git" |
| 107 |
}, |
| 108 |
"author": { |
| 109 |
"name": "James Halliday", |
| 110 |
"email": "[email protected]", |
| 111 |
"url": "http://substack.net" |
| 112 |
}, |
| 113 |
"bugs": { |
| 114 |
"url": "https://github.com/samn/json-stable-stringify/issues" |
| 115 |
}, |
| 116 |
"license": "MIT", |
| 117 |
"readmeFilename": "readme.markdown", |
| 118 |
"_attachments": {} |
| 119 |
} |