Skip to content

Commit 92d7921

Browse files
cjihrigtargos
authored andcommittedJul 10, 2018
lib: consolidate redundant require() calls
PR-URL: #21699 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Jon Moss <[email protected]>
1 parent 11e9b4e commit 92d7921

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed
 

‎lib/_http_outgoing.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ const assert = require('assert').ok;
2525
const Stream = require('stream');
2626
const util = require('util');
2727
const internalUtil = require('internal/util');
28-
const internalHttp = require('internal/http');
28+
const { outHeadersKey, utcDate } = require('internal/http');
2929
const { Buffer } = require('buffer');
3030
const common = require('_http_common');
3131
const checkIsHttpToken = common._checkIsHttpToken;
3232
const checkInvalidHeaderChar = common._checkInvalidHeaderChar;
33-
const { outHeadersKey } = require('internal/http');
3433
const {
3534
defaultTriggerAsyncIdScope,
3635
symbols: { async_id_symbol }
@@ -48,7 +47,6 @@ const {
4847
} = require('internal/errors').codes;
4948

5049
const { CRLF, debug } = common;
51-
const { utcDate } = internalHttp;
5250

5351
const kIsCorked = Symbol('isCorked');
5452

‎lib/internal/crypto/random.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const { AsyncWrap, Providers } = process.binding('async_wrap');
4-
const { Buffer } = require('buffer');
4+
const { Buffer, kMaxLength } = require('buffer');
55
const { randomBytes: _randomBytes } = process.binding('crypto');
66
const {
77
ERR_INVALID_ARG_TYPE,
@@ -10,7 +10,6 @@ const {
1010
} = require('internal/errors').codes;
1111
const { isArrayBufferView } = require('internal/util/types');
1212

13-
const { kMaxLength } = require('buffer');
1413
const kMaxUint32 = 2 ** 32 - 1;
1514
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
1615

‎lib/internal/http2/core.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
/* eslint-disable no-use-before-define */
44

5-
require('internal/util').assertCrypto();
5+
const internalUtil = require('internal/util');
6+
internalUtil.assertCrypto();
67

78
const { internalBinding } = require('internal/bootstrap/loaders');
89
const { async_id_symbol } = require('internal/async_hooks').symbols;
@@ -71,7 +72,7 @@ const { utcDate } = require('internal/http');
7172
const {
7273
promisify,
7374
customInspectSymbol: kInspect
74-
} = require('internal/util');
75+
} = internalUtil;
7576
const { isArrayBufferView } = require('internal/util/types');
7677
const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
7778
const { _connectionListener: httpConnectionListener } = http;

‎lib/internal/modules/esm/translators.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ const fs = require('fs');
1414
const { _makeLong } = require('path');
1515
const { SafeMap } = require('internal/safe_globals');
1616
const { URL } = require('url');
17-
const debug = require('util').debuglog('esm');
18-
const readFileAsync = require('util').promisify(fs.readFile);
17+
const util = require('util');
18+
const debug = util.debuglog('esm');
19+
const readFileAsync = util.promisify(fs.readFile);
1920
const readFileSync = fs.readFileSync;
2021
const StringReplace = Function.call.bind(String.prototype.replace);
2122
const JsonParse = JSON.parse;

0 commit comments

Comments
 (0)
Please sign in to comment.