Skip to content

Commit 0f2642e

Browse files
DavidCai1111MylesBorins
authored andcommitted
errors: remove needless lazyAssert
PR-URL: #11891 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
1 parent 486bd1b commit 0f2642e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/internal/errors.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
// value statically and permanently identifies the error. While the error
77
// message may change, the code should not.
88

9+
const assert = require('assert');
910
const kCode = Symbol('code');
1011
const messages = new Map();
1112

12-
var assert, util;
13-
function lazyAssert() {
14-
if (!assert)
15-
assert = require('assert');
16-
return assert;
17-
}
18-
13+
var util;
1914
function lazyUtil() {
2015
if (!util)
2116
util = require('util');
@@ -41,7 +36,6 @@ function makeNodeError(Base) {
4136
}
4237

4338
function message(key, args) {
44-
const assert = lazyAssert();
4539
assert.strictEqual(typeof key, 'string');
4640
const util = lazyUtil();
4741
const msg = messages.get(key);
@@ -60,7 +54,6 @@ function message(key, args) {
6054
// Utility function for registering the error codes. Only used here. Exported
6155
// *only* to allow for testing.
6256
function E(sym, val) {
63-
const assert = lazyAssert();
6457
assert(messages.has(sym) === false, `Error symbol: ${sym} was already used.`);
6558
messages.set(sym, typeof val === 'function' ? val : String(val));
6659
}

0 commit comments

Comments
 (0)