diff options
Diffstat (limited to 'lib/utils.js')
-rw-r--r-- | lib/utils.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils.js b/lib/utils.js index 7932e05f..32d410a1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -87,9 +87,11 @@ DefaultsError.prototype.name = "DefaultsError"; configure_error_stack(DefaultsError); function defaults(args, defs, croak) { - 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]; + if (croak) for (var i in args) { + if (HOP(args, i) && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs); + } + for (var i in args) { + if (HOP(args, i)) defs[i] = args[i]; } return defs; } |