diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-11-28 13:15:01 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-11-28 13:15:01 +0200 |
commit | c16d538ce7879af6077be3baf4ada87477c4354b (patch) | |
tree | 6ffb1f7608ae9c7bd9c35f1754dbe839cb3914ec /lib/utils.js | |
parent | 73d082df2e22e44257b333961f20b2a5a81a934c (diff) | |
download | tracifyjs-c16d538ce7879af6077be3baf4ada87477c4354b.tar.gz tracifyjs-c16d538ce7879af6077be3baf4ada87477c4354b.zip |
Add --noerr to turn off argument name checking
for now only used for keys passed to `-c` or `-b`.
Diffstat (limited to 'lib/utils.js')
-rw-r--r-- | lib/utils.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/utils.js b/lib/utils.js index 73964a09..fa24663c 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -86,12 +86,16 @@ function DefaultsError(msg, defs) { this.defs = defs; }; +DefaultsError.croak = function(msg, defs) { + throw new DefaultsError(msg, defs); +}; + function defaults(args, defs, croak) { if (args === true) args = {}; var ret = args || {}; if (croak) for (var i in ret) if (ret.hasOwnProperty(i) && !defs.hasOwnProperty(i)) - throw new DefaultsError("`" + i + "` is not a supported option", defs); + DefaultsError.croak("`" + i + "` is not a supported option", defs); for (var i in defs) if (defs.hasOwnProperty(i)) { ret[i] = (args && args.hasOwnProperty(i)) ? args[i] : defs[i]; } |