{"_id":"stringify-object-es5","_rev":"6-43dac0210e79454b2c1203dd0c652b62","name":"stringify-object-es5","dist-tags":{"latest":"2.5.0"},"versions":{"2.5.0":{"name":"stringify-object-es5","version":"2.5.0","keywords":["object","stringify","pretty","print","dump","format","type","json"],"author":{"name":"Justin Searls","email":"searls@gmail.com"},"license":"BSD-2-Clause","_id":"stringify-object-es5@2.5.0","maintainers":[{"name":"searls","email":"searls@gmail.com"}],"homepage":"https://github.com/searls/stringify-object#readme","bugs":{"url":"https://github.com/searls/stringify-object/issues"},"dist":{"shasum":"057c3c9a90a127339bb9d1704a290bb7bd0a1ec5","tarball":"https://registry.npmjs.org/stringify-object-es5/-/stringify-object-es5-2.5.0.tgz","integrity":"sha512-vE7Xdx9ylG4JI16zy7/ObKUB+MtxuMcWlj/WHHr3+yAlQoN6sst2stU9E+2Qs3OrlJw/Pf3loWxL1GauEHf6MA==","signatures":[{"sig":"MEQCIHOfkDlieB1Qf6CLv0f0LMYI92zCB5T1CznOvHQivk/4AiARozCpHpsXndRzsR6MjvTI4iHZ7Nv7zxQk/RgmqVMluw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["index.js"],"_shasum":"057c3c9a90a127339bb9d1704a290bb7bd0a1ec5","engines":{"node":">=0.10.0"},"gitHead":"d9275270603e9624335d842d2a3020cc306de3f3","scripts":{"test":"mocha"},"_npmUser":{"name":"searls","email":"searls@gmail.com"},"repository":{"url":"git+https://github.com/searls/stringify-object.git","type":"git"},"_npmVersion":"3.10.9","description":"Stringify an object/array like JSON.stringify just without all the double-quotes (ES5 compatible)","directories":{},"_nodeVersion":"6.9.2","dependencies":{"is-regexp":"^1.0.0","is-plain-obj":"^1.0.0"},"devDependencies":{"mocha":"*"},"_npmOperationalInternal":{"tmp":"tmp/stringify-object-es5-2.5.0.tgz_1489342526108_0.4675416173413396","host":"packages-12-west.internal.npmjs.com"}}},"time":{"created":"2017-03-12T18:15:28.209Z","modified":"2026-09-21T16:42:32.433Z","2.5.0":"2017-03-12T18:15:28.209Z"},"bugs":{"url":"https://github.com/searls/stringify-object/issues"},"author":{"name":"Justin Searls","email":"searls@gmail.com"},"license":"BSD-2-Clause","homepage":"https://github.com/searls/stringify-object#readme","keywords":["object","stringify","pretty","print","dump","format","type","json"],"repository":{"url":"git+https://github.com/searls/stringify-object.git","type":"git"},"description":"Stringify an object/array like JSON.stringify just without all the double-quotes (ES5 compatible)","maintainers":[{"email":"dustin@testdouble.com","name":"dustin.tinney"},{"email":"mike@testdouble.com","name":"mike.testdouble"},{"email":"ross.brandes@gmail.com","name":"rosston"},{"email":"searls@gmail.com","name":"searls"}],"readme":"# stringify-object [![Build Status](https://secure.travis-ci.org/searls/stringify-object.svg?branch=master)](http://travis-ci.org/searls/stringify-object)\n\n**This fork of [yeoman/stringify-object](https://github.com/yeoman/stringify-object) is ES5 compatible**\n\n> Stringify an object/array like JSON.stringify just without all the double-quotes.\n\nUseful for when you want to get the string representation of an object in a formatted way.\n\nIt also handles circular references and lets you specify quote type.\n\n\n## Install\n\n```\n$ npm install --save stringify-object\n```\n\n\n## Usage\n\n```js\nvar obj = {\n\tfoo: 'bar',\n\t'arr': [1, 2, 3],\n\tnested: { hello: \"world\" }\n};\n\nvar pretty = stringifyObject(obj, {\n\tindent: '  ',\n\tsingleQuotes: false\n});\n\nconsole.log(pretty);\n/*\n{\n\tfoo: \"bar\",\n\tarr: [\n\t\t1,\n\t\t2,\n\t\t3\n\t],\n\tnested: {\n\t\thello: \"world\"\n\t}\n}\n*/\n```\n\n\n## API\n\n### stringifyObject(input, [options])\n\nCircular references will be replaced with `\"[Circular]\"`.\n\n#### input\n\n*Required*  \nType: `object`, `array`\n\n#### options\n\n##### indent\n\nType: `string`  \nDefault: `'\\t'`\n\nChoose the indentation you prefer.\n\n##### singleQuotes\n\nType: `boolean`  \nDefault: `true`\n\nSet to false to get double-quoted strings.\n\n##### filter(obj, prop)\n\nType: `function`\n\nExpected to return a boolean of whether to keep the object.\n\n##### transform(obj, prop, originalResult)\n\nType: `Function`<br>\nDefault: `undefined`\n\nExpected to return a `string` that transforms the string that resulted from stringifying `obj[prop]`. This can be used to detect special types of objects that need to be stringified in a particular way. The `transform` function might return an alternate string in this case, otherwise returning the `originalResult`.\n\nHere's an example that uses the `transform` option to mask fields named \"password\":\n\n```js\nconst obj = {\n\tuser: 'becky',\n\tpassword: 'secret'\n}\n\nconst pretty = stringifyObject(obj, {\n\ttransform: function (obj, prop, originalResult) {\n\t\tif (prop === 'password') {\n\t\t\treturn originalResult.replace(/\\w/g,'*');\n\t\t} else {\n\t\t\treturn originalResult;\n\t\t}\n\t}\n});\n\nconsole.log(pretty);\n/*\n{\n\tuser: 'becky',\n\tpassword: '******'\n}\n*/\n```\n\n\n##### inlineCharacterLimit\n\nType: `number`\nDefault: undefined\n\nWhen set, will inline values up to `inlineCharacterLimit` length for the sake\nof more terse output.\n\nFor example, given the example at the top of the README:\n\n```js\nvar obj = {\n\tfoo: 'bar',\n\t'arr': [1, 2, 3],\n\tnested: { hello: \"world\" }\n};\n\nvar pretty = stringifyObject(obj, {\n\tindent: '  ',\n\tsingleQuotes: false,\n\tinlineCharacterLimit: 12\n});\n\nconsole.log(pretty);\n/*\n{\n\tfoo: \"bar\",\n\tarr: [1, 2, 3],\n\tnested: {\n\t\thello: \"world\"\n\t}\n}\n*/\n```\n\nAs you can see, `arr` was printed as a one-liner because its string was shorter\nthan 12 characters.\n\n## License\n\n[BSD license](http://opensource.org/licenses/bsd-license.php) © Yeoman Team\n","readmeFilename":"readme.md"}