diff options
author | DavidCai <davidcai1993@yahoo.com> | 2017-03-17 14:13:58 +0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-21 23:29:03 -0700 |
commit | a00c9e95e42300839b541dcdfd85e1d96ef6e803 (patch) | |
tree | afa4f9a273181449747a426b3b606623f21b6696 /lib | |
parent | 757ff8071e212703e3e8f2849751e7745479ac87 (diff) | |
download | android-node-v8-a00c9e95e42300839b541dcdfd85e1d96ef6e803.tar.gz android-node-v8-a00c9e95e42300839b541dcdfd85e1d96ef6e803.tar.bz2 android-node-v8-a00c9e95e42300839b541dcdfd85e1d96ef6e803.zip |
errors: remove needless lazyAssert
PR-URL: https://github.com/nodejs/node/pull/11891
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/errors.js | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 3cab140942..01e4e482cb 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -6,16 +6,11 @@ // value statically and permanently identifies the error. While the error // message may change, the code should not. +const assert = require('assert'); const kCode = Symbol('code'); const messages = new Map(); -var assert, util; -function lazyAssert() { - if (!assert) - assert = require('assert'); - return assert; -} - +var util; function lazyUtil() { if (!util) util = require('util'); @@ -41,7 +36,6 @@ function makeNodeError(Base) { } function message(key, args) { - const assert = lazyAssert(); assert.strictEqual(typeof key, 'string'); const util = lazyUtil(); const msg = messages.get(key); @@ -60,7 +54,6 @@ function message(key, args) { // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val) { - const assert = lazyAssert(); assert(messages.has(sym) === false, `Error symbol: ${sym} was already used.`); messages.set(sym, typeof val === 'function' ? val : String(val)); } |