Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/defaults/index.js')
-rw-r--r--node_modules/defaults/index.js13
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 000000000..cb7d75c9c
--- /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