aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-04-18 11:03:06 +0100
committerGitHub <noreply@github.com>2020-04-18 18:03:06 +0800
commit708973e51d418230918a2d0c2fcafb79d1e1c250 (patch)
tree65f9de4f3a24071e6171494f32438f20c938e980 /lib
parentdac9e69f9efb491c274670f36301fd38b0ef4dd6 (diff)
downloadtracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.tar.gz
tracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.zip
report top-level default options (#3797)
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.js8
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;
}