{"_id":"@aitodotai/json-stringify-pretty-compact","_rev":"1-69f33e24b463aec8b4c292335f4f72e9","name":"@aitodotai/json-stringify-pretty-compact","dist-tags":{"latest":"1.3.0"},"versions":{"1.3.0":{"name":"@aitodotai/json-stringify-pretty-compact","version":"1.3.0","author":{"name":"Simon Lydell and Aito Intelligence"},"license":"MIT","description":"The best of both `JSON.stringify(obj)` and `JSON.stringify(obj, null, indent)`.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/AitoDotAI/json-stringify-pretty-compact.git"},"publishConfig":{"access":"public"},"keywords":["JSON","stringify","pretty","print","pretty-print","compact","indent","format","formatter"],"scripts":{"lint":"standard","unit":"mocha --ui tdd","test":"npm run lint && npm run unit","publish":"np --no-yarn"},"devDependencies":{"chai":"^4.1.2","mocha":"^4.1.0","np":"^4.0.2","standard":"^10.0.3"},"gitHead":"21b052d1c3d2dafee9319854471bfe1cff2f770e","bugs":{"url":"https://github.com/AitoDotAI/json-stringify-pretty-compact/issues"},"homepage":"https://github.com/AitoDotAI/json-stringify-pretty-compact#readme","_id":"@aitodotai/json-stringify-pretty-compact@1.3.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"kimmobrunfeldt","email":"kimmo.brunfeldt+public@gmail.com"},"dist":{"integrity":"sha512-K+whdCBlVjzx8zCK2ZUohGJb5bUOxRpiEAfD1NCUgH0mApdDZD9c7VHXJVzWlt3wfV1X4OFyCRmTqbPd6U87lQ==","shasum":"a3fedb95f356f532d115268df4b156e682242345","tarball":"https://registry.npmjs.org/@aitodotai/json-stringify-pretty-compact/-/json-stringify-pretty-compact-1.3.0.tgz","fileCount":6,"unpackedSize":10244,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcUXCbCRA9TVsSAnZWagAAgyQP/1pAEmSxIR5faAAbf/VC\nl8yns/rPCf7N5wMdcgo5cQfjiSRkt8XV4XVRZ5aYnqLaCPc1LUDIp3qyHUEn\nqojtakEJm1J5uEot5fdv8wK8JPjhRRmDz3g0joZotVYn4hdP6d3RPSMxJ2V9\nOYtwPi6PtYOmZDu0pF6JoWFNcDvUB2laARnDEb5aO77k/v4cQo0aG59G7psn\n/aJmz9zE4kg0vHoOECEFEO3f1qcFC0XGnIKJP5WSvAfXIQ8Rx3CieEl+wP2I\nxHGEFO9t9SnwQKptggK04f6Oor9E6wHfhq7uIOj98CdO9T0LzPg1t2RO+pL8\nVP5Z92Hej6PzaSpYD3HQigwmaot0zQDEedwSZOgp+iw0IjgIKsiAukT1A8Mj\n7AOJujeLV3oN33aChisPyP1bFOkzb5b1nJGLylnNZudp3Ys+PIaK+B8KLia5\nz6SLKpVLeUx/kKF+WjX5qI+LFaP9cN//ucd3qxLg/ibY0P30ehLxUH14mfuI\n2ROLEvWboiFH+adrlbrWozsxSUHweNTv1FcT8j+GtKbileBPO7QeXCe/NcvL\nIY8ZLJnJ+mkEa+/yuRlt59qQv9Bobl26nl4fWxYieo0ZZiYmMn3eeH+EjxXW\nMObQJxokutsDpYLUlNjkNcg4CkHwjDyn+KpUyCTDNI9Bo4I1jgQOdW80LPTH\n4Z6/\r\n=0kJv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+8acNh1ZROmHmssKhR4JSPMk8ux6JdQtpZXo53jl1lwIhAK9pM1klJQCmqU5sN1m9NahYAc1jN4kD2odZJUbAiWa7"}]},"maintainers":[{"name":"cventus","email":"christoffer@aito.ai"},{"name":"kaiinkinen","email":"kai.inkinen@gmail.com"},{"name":"tri.nguyen","email":"tri.nguyen@aito.ai"},{"name":"phuch","email":"hongphuc0226@gmail.com"},{"name":"ollkan","email":"olli.kanerva@aito.ai"},{"name":"kimmobrunfeldt","email":"kimmo.brunfeldt+public@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-stringify-pretty-compact_1.3.0_1548841115088_0.25272014439501134"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-30T09:38:34.908Z","1.3.0":"2019-01-30T09:38:35.210Z","modified":"2022-04-04T12:25:33.817Z"},"maintainers":[{"name":"cventus","email":"christoffer@aito.ai"},{"name":"kaiinkinen","email":"kai.inkinen@gmail.com"},{"name":"tri.nguyen","email":"tri.nguyen@aito.ai"},{"name":"phuch","email":"hongphuc0226@gmail.com"},{"name":"ollkan","email":"olli.kanerva@aito.ai"},{"name":"kimmobrunfeldt","email":"kimmo.brunfeldt+public@gmail.com"}],"description":"The best of both `JSON.stringify(obj)` and `JSON.stringify(obj, null, indent)`.","homepage":"https://github.com/AitoDotAI/json-stringify-pretty-compact#readme","keywords":["JSON","stringify","pretty","print","pretty-print","compact","indent","format","formatter"],"repository":{"type":"git","url":"git+https://github.com/AitoDotAI/json-stringify-pretty-compact.git"},"author":{"name":"Simon Lydell and Aito Intelligence"},"bugs":{"url":"https://github.com/AitoDotAI/json-stringify-pretty-compact/issues"},"license":"MIT","readme":"**Fork information:** This is a maintained fork which implements these additional options: `maxNesting`, `arrayMargins`, and `objectMargins`.\n\n\nOverview [![Build Status](https://travis-ci.org/AitoDotAI/json-stringify-pretty-compact.svg?branch=master)](https://travis-ci.org/AitoDotAI/json-stringify-pretty-compact) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n========\n\nThe output of `JSON.stringify` comes in two flavors: _compact_ and _pretty._ The\nformer is usually too compact to be read by humans, while the latter sometimes\nis too spacious. This module trades performance (and the “replacer” argument)\nfor a compromise between the two. The result is a _pretty_ compact string, where\n“pretty” means both “kind of” and “nice”.\n\n```json\n{\n  \"bool\": true,\n  \"short array\": [1, 2, 3],\n  \"long array\": [\n    {\"x\": 1, \"y\": 2},\n    {\"x\": 2, \"y\": 1},\n    {\"x\": 1, \"y\": 1},\n    {\"x\": 2, \"y\": 2}\n  ]\n}\n```\n\nWhile the “pretty” mode of `JSON.stringify` puts every item of arrays and\nobjects on its own line, this module puts the whole array or object on a single\nline, unless the line becomes too long (the default maximum is 80 characters).\nMaking arrays and objects multi-line is the only attempt made to enforce the\nmaximum line length; if that doesn’t help then so be it.\n\n\nInstallation\n============\n\n`npm install @aitodotai/json-stringify-pretty-compact`\n\n```js\nvar stringify = require(\"json-stringify-pretty-compact\")\n```\n\n\nUsage\n=====\n\n`stringify(obj, [options])`\n---------------------------\n\nIt’s like `JSON.stringify(obj, null, options.indent)`, except that objects and\narrays are on one line if they fit (according to `options.maxLength`).\n\n`options`:\n\n- indent: Defaults to 2. Works exactly like the third parameter of\n  `JSON.stringify`.\n- maxLength: Defaults to 80. Lines will be tried to be kept at maximum this many\n  characters long.\n- maxNesting: Defaults to `Infinity`. The maximum amount of allowed inline nesting for objects or arrays\n\n    By default, the output can contain arbitrary amount of nested structures (as long as\n    the maxLength is not exceeded), like below:\n\n    ```json\n    {\"a\": [{\"b\": [\"test1\", \"test2\"]}, {\"c\": true}]}}\n    ```\n\n    When maxNesting is set to `0`, the output doesn't allow any nesting:\n    ```json\n    {\n      \"a\": [\n        {\n          \"b\": [\n            \"test1\",\n            \"test2\"\n          ]\n        },\n        {\n          \"c\": true\n        }\n      ]\n    }\n    ```\n\n- margins: Defaults to `false`. Whether or not to add “margins” around brackets\n  and braces:\n  - `false`: `{\"a\": [1]}`\n  - `true`: `{ \"a\": [ 1 ] }`\n- arrayMargins: Defaults to `false`. Whether or not to add “margins” around brackets:\n  - `false`: `{\"a\": [1]}`\n  - `true`: `{\"a\": [ 1 ]}`\n- arrayMargins: Defaults to `true`. Whether or not to add “margins” around braces:\n  - `false`: `{\"a\": [1]}`\n  - `true`: `{ \"a\": [1] }`\n\n`stringify(obj, {maxLength: 0, indent: indent})` gives the exact same result as\n`JSON.stringify(obj, null, indent)`.\n\n`stringify(obj, {maxLength: Infinity})` gives the exact same result as\n`JSON.stringify(obj)`, except that there are spaces after colons and commas.\n\n\n## Releasing\n\nExample of publishing new release with patch change:\n\n`npm run publish -- patch`\n\n\nLicense\n=======\n\n[MIT](LICENSE).\n","readmeFilename":"README.md"}