{"name":"defaults","version":"1.0.0","description":"merge single level defaults over a config object","main":"index.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git://github.com/tmpvar/defaults.git"},"keywords":["config","defaults"],"author":{"name":"Elijah Insua","email":"tmpvar@gmail.com"},"license":"MIT","dependencies":{"clone":"~0.1.5"},"devDependencies":{"tap":"~0.4.0"},"_id":"defaults@1.0.0","dist":{"shasum":"3ae25f44416c6c01f9809a25fcdd285912d2a6b1","tarball":"http://registry-npm.ywwl.com/defaults/download/defaults-1.0.0.tgz","integrity":"sha512-q5MK17gMColp1lfz5AEjZNKA6tM5QjZA7OeqPdGKnihB2N+msGtV3DoYkF4evmhiK8Opbow11mvhqCcJhLSbnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBI5FCYAMZtrNbgDbMgTbLBS9c/8Gzwq8FgVHZ1RjQ3bAiEApNRYztApdb7UAamajMoxq54fVkEMADGNUKHT6TTXpQI="}],"size":1313,"noattachment":false,"key":"/defaults/-/defaults-1.0.0.tgz"},"_npmVersion":"1.1.65","_npmUser":{"name":"tmpvar","email":"tmpvar@gmail.com"},"maintainers":[{"name":"tmpvar","email":"tmpvar@gmail.com"}],"directories":{},"readme":"# defaults\n\n> Easily handle defaults for your options\n\n## Install\n\n```sh\nnpm install defaults\n```\n\n## Usage\n\n```js\nimport defaults from 'defaults';\n\nconst calculate = options => {\n\toptions = defaults(options, {\n\t\ttimeout: {\n\t\t\tbefore: 100,\n\t\t\tafter: 100\n\t\t}\n\t});\n\n\tconsole.log(options);\n\t//=> {timeout: {before: 200, after: 100}}\n\n\t// …\n}\n\n// …\n\ncalculate({timeout: {before: 200}});\n```\n\n## API\n\n### defaults(options, defaultOptions?)\n\nDeeply merges the given options with the specified defaults and returns a new object.\n\nThe given parameters are deep-cloned and never mutated.\n\n#### options\n\nType: `object`\n\nThe user-provided options.\n\nIf the value is not a plain object, a new plain object will be used instead.\n\n#### defaultOptions\n\nType: `object | undefined`\n\nThe default options to use when a value is not provided in the `options` object.\n\n## FAQ\n\n### Why use this over [object-spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#spread_in_object_literals)?\n\n- Does not overwrite options if they are not defined in the `options` object\n- Supports deep merging of objects\n- Provides protection against prototype pollution attacks\n","publish_time":1359858178793,"_cnpm_publish_time":1359858178793,"dist-tags":{"latest":"3.0.0"}}