File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 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' ) ;
910const kCode = Symbol ( 'code' ) ;
1011const 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 ;
1914function lazyUtil ( ) {
2015 if ( ! util )
2116 util = require ( 'util' ) ;
@@ -41,7 +36,6 @@ function makeNodeError(Base) {
4136}
4237
4338function 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.
6256function 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}
You can’t perform that action at this time.
0 commit comments