We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4ddb2e commit 8da63ffCopy full SHA for 8da63ff
index.js
@@ -5,13 +5,10 @@ module.exports = assert
5
6
function assert (value, status, msg, opts) {
7
if (value) return
8
- if (msg === undefined) {
9
- throw createError(status)
10
- } else if (opts === undefined) {
11
- throw createError(status, msg)
12
- } else {
13
- throw createError(status, msg, opts)
14
- }
+ var args = [status]
+ if (msg !== undefined) args.push(msg)
+ if (opts !== undefined) args.push(opts)
+ throw createError.apply(null, args)
15
}
16
17
assert.fail = function (status, msg, opts) {
0 commit comments