{"_id":"silver-fleece","_rev":"2-f61bc1dbe125a5376f5ad4d63b334908","name":"silver-fleece","dist-tags":{"latest":"1.2.1"},"versions":{"1.1.0":{"name":"silver-fleece","version":"1.1.0","_id":"silver-fleece@1.1.0","maintainers":[{"name":"evertheylen","email":"evertheylen@gmail.com"}],"homepage":"https://github.com/evertheylen/silver-fleece#readme","bugs":{"url":"https://github.com/evertheylen/silver-fleece/issues"},"dist":{"shasum":"6afb854c7b97a647163c5d5812cbae58c9eca5c1","tarball":"https://registry.npmjs.org/silver-fleece/-/silver-fleece-1.1.0.tgz","fileCount":19,"integrity":"sha512-V3vShUiLRVPMu9aSWpU5kLDoU/HO7muJKE236EO663po3YxivAkMLbRg+amV/FhbIfF5bWXX5TVX+VYmRaOBFA==","signatures":[{"sig":"MEUCICm0m+Dt6tqm6qoWb3UtaKTT4pgivW0bvy2raqxlhqJwAiEA6vlMqUf6fcq+3Q/XsmaiPLPo7hqH8fuLpx9TXpyy2pw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":65318},"main":"silver-fleece.umd.js","_from":"file:silver-fleece-1.1.0.tgz","types":"types/index.d.ts","module":"silver-fleece.es.js","scripts":{"test":"mocha --require ts-node/register test/test.ts","build":"npm run build-declarations && rollup -c","build-declarations":"tsc -d && node scripts/move-declaration-files.js"},"_npmUser":{"name":"evertheylen","email":"evertheylen@gmail.com"},"_resolved":"/tmp/d3ef5926c190a135cef8a46d5beec46e/silver-fleece-1.1.0.tgz","_integrity":"sha512-V3vShUiLRVPMu9aSWpU5kLDoU/HO7muJKE236EO663po3YxivAkMLbRg+amV/FhbIfF5bWXX5TVX+VYmRaOBFA==","repository":{"url":"git+https://github.com/evertheylen/silver-fleece.git","type":"git"},"_npmVersion":"8.19.2","description":"Parse and manipulate JSON strings","directories":{},"_nodeVersion":"19.9.0","_hasShrinkwrap":false,"devDependencies":{"glob":"^10.2.3","mocha":"^10.2.0","tslib":"^2.5.0","rollup":"^3.21.6","sander":"^0.6.0","ts-node":"^10.9.1","typescript":"^5.0.4","@types/glob":"^8.1.0","@types/node":"^20.1.3","@types/mocha":"^10.0.1","locate-character":"^2.0.5","@rollup/plugin-typescript":"^11.1.0","@rollup/plugin-node-resolve":"^15.0.2"},"_npmOperationalInternal":{"tmp":"tmp/silver-fleece_1.1.0_1683888208730_0.6764930531689397","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"silver-fleece","version":"1.2.0","_id":"silver-fleece@1.2.0","maintainers":[{"name":"evertheylen","email":"evertheylen@gmail.com"}],"homepage":"https://github.com/evertheylen/silver-fleece#readme","bugs":{"url":"https://github.com/evertheylen/silver-fleece/issues"},"dist":{"shasum":"d0187e953ec237a4e1dfc4f26cda5c2b43de4266","tarball":"https://registry.npmjs.org/silver-fleece/-/silver-fleece-1.2.0.tgz","fileCount":21,"integrity":"sha512-HybmIKLTyaHfO6mSNYHYcE5tAfabCA9zw2hI9KRyWgv7kMf3uLlXxsCrE8uXFADRd7uQYKFqU+a6cTd2+Gv7Wg==","signatures":[{"sig":"MEYCIQCKPrYNx0Ad3Fc7CH/VeND0B1bFw+BUNhsbeMfNlKVDQwIhALV/rdqVxb5h4ZUpl7ShAKZ7zxMUROIh8oDQTtHxcUAK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67873},"main":"dist/silver-fleece.umd.js","_from":"file:silver-fleece-1.2.0.tgz","types":"types/index.d.ts","module":"dist/silver-fleece.es.js","scripts":{"test":"mocha --require ts-node/register test/test.ts","build":"tsc -d && rollup -c"},"_npmUser":{"name":"evertheylen","email":"evertheylen@gmail.com"},"_resolved":"/tmp/0299c18ddfa1f01381909b6199df1f53/silver-fleece-1.2.0.tgz","_integrity":"sha512-HybmIKLTyaHfO6mSNYHYcE5tAfabCA9zw2hI9KRyWgv7kMf3uLlXxsCrE8uXFADRd7uQYKFqU+a6cTd2+Gv7Wg==","repository":{"url":"git+https://github.com/evertheylen/silver-fleece.git","type":"git"},"_npmVersion":"10.8.3","description":"Parse and manipulate JSON strings","directories":{},"_nodeVersion":"22.9.0","_hasShrinkwrap":false,"devDependencies":{"glob":"^11.0.0","mocha":"^10.7.3","tslib":"^2.8.0","rollup":"^4.24.0","ts-node":"^10.9.2","typescript":"^5.6.3","@types/glob":"^8.1.0","@types/node":"^22.7.5","@types/mocha":"^10.0.9","@rollup/plugin-typescript":"^12.1.1","@rollup/plugin-node-resolve":"^15.3.0"},"_npmOperationalInternal":{"tmp":"tmp/silver-fleece_1.2.0_1729097038478_0.6091911874821816","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"silver-fleece","description":"Parse and manipulate JSON strings","version":"1.2.1","main":"dist/silver-fleece.umd.js","module":"dist/silver-fleece.es.mjs","types":"dist/index.d.ts","devDependencies":{"@rollup/plugin-node-resolve":"^15.3.0","@rollup/plugin-typescript":"^12.1.1","@types/glob":"^8.1.0","@types/mocha":"^10.0.9","@types/node":"^22.7.5","glob":"^11.0.0","mocha":"^10.7.3","rollup":"^4.24.0","ts-node":"^10.9.2","tslib":"^2.8.0","typescript":"^5.6.3"},"repository":{"type":"git","url":"git+https://github.com/evertheylen/silver-fleece.git"},"scripts":{"build":"tsc -d && rollup -c","test":"mocha --require ts-node/register test/test.ts"},"_id":"silver-fleece@1.2.1","bugs":{"url":"https://github.com/evertheylen/silver-fleece/issues"},"homepage":"https://github.com/evertheylen/silver-fleece#readme","_integrity":"sha512-GwiBh7LzX4aKWb3LH1tPu8et2zZqe1cwXn+/uwIUK+H1Y2k119qpvPelVdRKG/6+RQvtUdRep4mBOOVf80VYDA==","_resolved":"/tmp/8ad10fe228c934b56391c5c2c9a01e3e/silver-fleece-1.2.1.tgz","_from":"file:silver-fleece-1.2.1.tgz","_nodeVersion":"22.9.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-GwiBh7LzX4aKWb3LH1tPu8et2zZqe1cwXn+/uwIUK+H1Y2k119qpvPelVdRKG/6+RQvtUdRep4mBOOVf80VYDA==","shasum":"111924101addd844bbc1d7304ee2759f63022db0","tarball":"https://registry.npmjs.org/silver-fleece/-/silver-fleece-1.2.1.tgz","fileCount":22,"unpackedSize":87827,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNggRVHkxgrUKuLJllL6JVy8BloZsZqLiEcxMRzzaz6AIgLPEXgnokM0fzn2NrK9FxwoVUobzV80wX7c2KRVm+5d8="}]},"_npmUser":{"name":"evertheylen","email":"evertheylen@gmail.com"},"directories":{},"maintainers":[{"name":"evertheylen","email":"evertheylen@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/silver-fleece_1.2.1_1729242112422_0.5724152217687479"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-12T10:43:28.730Z","modified":"2024-10-18T09:01:52.808Z","1.1.0":"2023-05-12T10:43:28.895Z","1.2.0":"2024-10-16T16:43:58.638Z","1.2.1":"2024-10-18T09:01:52.632Z"},"bugs":{"url":"https://github.com/evertheylen/silver-fleece/issues"},"homepage":"https://github.com/evertheylen/silver-fleece#readme","repository":{"type":"git","url":"git+https://github.com/evertheylen/silver-fleece.git"},"description":"Parse and manipulate JSON strings","maintainers":[{"name":"evertheylen","email":"evertheylen@gmail.com"}],"readme":"# silver-fleece\n\nForked from [golden-fleece](https://github.com/Rich-Harris/golden-fleece) but adjusted and\nsimplified to parse normal JSON with comments. This makes it a bit faster, and the output will always\nbe parsable by standard JSON parsers (comments are only added if you add them).\n\n## Why?\n\nPatching files like `package.json` or `tsconfig.json`.\n\n## Usage\n\nInstall it with `npm install silver-fleece` and import it into your app:\n\n```js\nimport * as fleece from 'silver-fleece';\n```\n\n### fleece.parse(str, [options])\n\n```js\nconst ast = fleece.parse(`true`);\n// { start: 0, end: 4, type: 'Literal', raw: 'true', value: true }\n```\n\nThe returned AST is [ESTree](https://github.com/estree/estree) compliant.\n\nYou can optionally pass callbacks that are fired whenever a value or comment is encountered:\n\n```js\nconst ast = fleece.parse(str, {\n\tonComment: comment => {\n\t\tconsole.log('got a comment', comment);\n\t},\n\tonValue: value => {\n\t\tconsole.log('got a value', value);\n\t}\n});\n```\n\n\n### fleece.evaluate(str)\n\n```js\nconst { answer } = fleece.evaluate(`{ \"answer\": 42 }`);\nanswer === 42; // true\n```\n\n\n### fleece.patch(str, value)\n\nThis is where it gets fun:\n\n```js\nconst str = `\n\t\"number\": 1,\n\t\"string\": \"yes\",\n\t\"object\": { \"nested\": true },\n\t\"array\": [\"this\", \"that\", \"the other\"]\n`;\n\nconst object = fleece.evaluate(str);\nobject.number = 42;\nobject.array[2] = 'EVERYTHING';\n\nfleece.patch(str, object) === `{\n\t\"number\": 42,\n\t\"string\": \"yes\",\n\t\"object\": { \"nested\": true },\n\t\"array\": [\"this\", \"that\", \"EVERYTHING\"]\n}`; // true\n```\n\nNotice that the formatting has been preserved.\n\n\n### fleece.stringify(value, [options])\n\n\n```js\nconst object = {\n\tstring: 'hello',\n\t'quoted-property': 2,\n\tarray: [3, 4]\n};\n\nfleece.stringify(object) === `{\n\t\"string\": \"hello\",\n\t\"quoted-property\": 2,\n\t\"array\": [\n\t\t3,\n\t\t4\n\t]\n}`; // true\n```\n\nTo indent with spaces instead of tabs, pass `spaces: n`, where `n` is the number of spaces at each level of indentation.\n\n```js\nfleece.stringify(object, {\n\tspaces: 2\n}) === `{\n  \"string\": \"hello\",\n  \"quoted-property\": 2,\n  \"array\": [\n    3,\n    4\n  ]\n}`; // true\n```\n\n## License and copyright\n\nOriginal golden-fleece code is owned and copyrighted by [Rich Harris and other contributors](https://github.com/Rich-Harris/golden-fleece/graphs/contributors).\nThey have released their contributions under the [LIL](LICENSE) license.\n\nThe silver-fleece changes are written by [Evert Heylen and other contributors](https://github.com/evertheylen/silver-fleece/graphs/contributors) and are also released under the same [LIL](LICENSE) license.\n","readmeFilename":"README.md"}