diff options
Diffstat (limited to 'node_modules/defaults/index.js')
-rw-r--r-- | node_modules/defaults/index.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/node_modules/defaults/index.js b/node_modules/defaults/index.js new file mode 100644 index 0000000..cb7d75c --- /dev/null +++ b/node_modules/defaults/index.js @@ -0,0 +1,13 @@ +var clone = require('clone'); + +module.exports = function(options, defaults) { + options = options || {}; + + Object.keys(defaults).forEach(function(key) { + if (typeof options[key] === 'undefined') { + options[key] = clone(defaults[key]); + } + }); + + return options; +};
\ No newline at end of file |