diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-04-18 11:03:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 18:03:06 +0800 |
commit | 708973e51d418230918a2d0c2fcafb79d1e1c250 (patch) | |
tree | 65f9de4f3a24071e6171494f32438f20c938e980 /lib | |
parent | dac9e69f9efb491c274670f36301fd38b0ef4dd6 (diff) | |
download | tracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.tar.gz tracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.zip |
report top-level default options (#3797)
Diffstat (limited to 'lib')
-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; } |