diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/utils.js b/lib/utils.js index 508aba9c..7932e05f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -87,15 +87,11 @@ DefaultsError.prototype.name = "DefaultsError"; configure_error_stack(DefaultsError); function defaults(args, defs, croak) { - if (args === true) args = {}; - var ret = args || {}; - if (croak) for (var i in ret) if (HOP(ret, i) && !HOP(defs, i)) { - throw new DefaultsError("`" + i + "` is not a supported option", defs); + for (var i in args) if (HOP(args, i)) { + if (croak && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs); + defs[i] = args[i]; } - for (var i in defs) if (HOP(defs, i)) { - ret[i] = (args && HOP(args, i)) ? args[i] : defs[i]; - } - return ret; + return defs; } function merge(obj, ext) { |