File tree 1 file changed +2
-9
lines changed
1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 6
6
// value statically and permanently identifies the error. While the error
7
7
// message may change, the code should not.
8
8
9
+ const assert = require ( 'assert' ) ;
9
10
const kCode = Symbol ( 'code' ) ;
10
11
const messages = new Map ( ) ;
11
12
12
- var assert , util ;
13
- function lazyAssert ( ) {
14
- if ( ! assert )
15
- assert = require ( 'assert' ) ;
16
- return assert ;
17
- }
18
-
13
+ var util ;
19
14
function lazyUtil ( ) {
20
15
if ( ! util )
21
16
util = require ( 'util' ) ;
@@ -41,7 +36,6 @@ function makeNodeError(Base) {
41
36
}
42
37
43
38
function message ( key , args ) {
44
- const assert = lazyAssert ( ) ;
45
39
assert . strictEqual ( typeof key , 'string' ) ;
46
40
const util = lazyUtil ( ) ;
47
41
const msg = messages . get ( key ) ;
@@ -60,7 +54,6 @@ function message(key, args) {
60
54
// Utility function for registering the error codes. Only used here. Exported
61
55
// *only* to allow for testing.
62
56
function E ( sym , val ) {
63
- const assert = lazyAssert ( ) ;
64
57
assert ( messages . has ( sym ) === false , `Error symbol: ${ sym } was already used.` ) ;
65
58
messages . set ( sym , typeof val === 'function' ? val : String ( val ) ) ;
66
59
}
You can’t perform that action at this time.
0 commit comments