{"name":"defaults","version":"1.0.2","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":"22c57d1f87a2f03c1f9d21bd39c67db8553a0064","bugs":{"url":"https://github.com/tmpvar/defaults/issues"},"homepage":"https://github.com/tmpvar/defaults","_id":"defaults@1.0.2","_shasum":"6902e25aa047649a501e19ef9e98f3e8365c109a","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"tmpvar","email":"tmpvar@gmail.com"},"maintainers":[{"name":"tmpvar","email":"tmpvar@gmail.com"}],"dist":{"shasum":"6902e25aa047649a501e19ef9e98f3e8365c109a","tarball":"http://registry-npm.ywwl.com/defaults/download/defaults-1.0.2.tgz","integrity":"sha512-JI67AYadZHq9m0ruR8vU7C/tfVKd7W+XdCQpeRIs+E+1tZBgzJ/nvXLV5OvLiHgElOeqhbSlBGRs6Up/1hXHqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClFM5Xcn4eAfKtz2VQD9io/iWeZbHVqIY1yLRd6UolggIgCTUffEMC+2ug+jYOtcxRq+6v7hTqPEUi79pMJD3f1pY="}],"size":1992,"noattachment":false,"key":"/defaults/-/defaults-1.0.2.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":1426390176798,"_cnpm_publish_time":1426390176798,"dist-tags":{"latest":"3.0.0"}}