{"name":"defaults","version":"1.0.1","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"},"gitHead":"d3ca162791cdbdb2c0313152ef89c57fcbf793c9","bugs":{"url":"https://github.com/tmpvar/defaults/issues"},"homepage":"https://github.com/tmpvar/defaults","_id":"defaults@1.0.1","_shasum":"00f1a15ad95ae500e287bfec9c4da918835c97ac","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"tmpvar","email":"tmpvar@gmail.com"},"maintainers":[{"name":"tmpvar","email":"tmpvar@gmail.com"}],"dist":{"shasum":"00f1a15ad95ae500e287bfec9c4da918835c97ac","tarball":"http://registry-npm.ywwl.com/defaults/download/defaults-1.0.1.tgz","integrity":"sha512-fhLSC93NrnHZaAW4O7ZvQozWXL3r84F2wz0qP4AiuzRTQgEB33jUaul1AjAQXfrOW7OaT6tKaZYiMfFJBBokwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDir29KvNRnQ9UU9wyFG2PMVcRBeeHz/xAQHyIXk7axVwIgFYbcZT+Dj8MfrLPtMlRF704ZcuQuMXgl2mvWy43T0+M="}],"size":1992,"noattachment":false,"key":"/defaults/-/defaults-1.0.1.tgz"},"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":1426389788224,"_cnpm_publish_time":1426389788224,"dist-tags":{"latest":"3.0.0"}}