Skip to content

Commit b79829c

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace String global with primordials
PR-URL: #35397 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Pranshu Srivastava <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
1 parent 693cc2c commit b79829c

File tree

18 files changed

+35
-6
lines changed

18 files changed

+35
-6
lines changed

lib/.eslintrc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ rules:
4949
message: "Use `const { RegExp } = primordials;` instead of the global."
5050
- name: Set
5151
message: "Use `const { Set } = primordials;` instead of the global."
52+
- name: String
53+
message: "Use `const { String } = primordials;` instead of the global."
5254
- name: Symbol
5355
message: "Use `const { Symbol } = primordials;` instead of the global."
5456
- name: Uint16Array

lib/_http_client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const {
2929
ObjectAssign,
3030
ObjectKeys,
3131
ObjectSetPrototypeOf,
32+
String,
3233
Symbol
3334
} = primordials;
3435

lib/assert.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const {
2929
Map,
3030
NumberIsNaN,
3131
RegExpPrototypeTest,
32+
String,
3233
} = primordials;
3334

3435
const { Buffer } = require('buffer');

lib/events.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const {
3535
PromiseResolve,
3636
ReflectApply,
3737
ReflectOwnKeys,
38+
String,
3839
Symbol,
3940
SymbolFor,
4041
SymbolAsyncIterator

lib/internal/assert/assertion_error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
ObjectDefineProperty,
88
ObjectGetPrototypeOf,
99
ObjectKeys,
10+
String,
1011
} = primordials;
1112

1213
const { inspect } = require('internal/util/inspect');

lib/internal/bootstrap/loaders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const {
5252
ObjectPrototypeHasOwnProperty,
5353
ReflectGet,
5454
SafeSet,
55+
String,
5556
} = primordials;
5657

5758
// Set up process.moduleLoadList.

lib/internal/errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
NumberIsInteger,
2222
ObjectDefineProperty,
2323
ObjectKeys,
24+
String,
2425
StringPrototypeStartsWith,
2526
Symbol,
2627
SymbolFor,

lib/internal/event_target.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
ObjectAssign,
1010
ObjectDefineProperties,
1111
ObjectDefineProperty,
12+
String,
1213
Symbol,
1314
SymbolFor,
1415
SymbolToStringTag,

lib/internal/http2/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const {
88
ObjectCreate,
99
ObjectKeys,
1010
Set,
11+
String,
12+
StringFromCharCode,
1113
StringPrototypeToLowerCase,
1214
Symbol,
1315
} = primordials;
@@ -459,8 +461,8 @@ const assertValidPseudoHeaderTrailer = hideStackFrames((key) => {
459461
});
460462

461463
const emptyArray = [];
462-
const kNeverIndexFlag = String.fromCharCode(NGHTTP2_NV_FLAG_NO_INDEX);
463-
const kNoHeaderFlags = String.fromCharCode(NGHTTP2_NV_FLAG_NONE);
464+
const kNeverIndexFlag = StringFromCharCode(NGHTTP2_NV_FLAG_NO_INDEX);
465+
const kNoHeaderFlags = StringFromCharCode(NGHTTP2_NV_FLAG_NONE);
464466
function mapToHeaders(map,
465467
assertValuePseudoHeader = assertValidPseudoHeader) {
466468
let ret = '';

lib/internal/process/warning.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const {
44
ArrayIsArray,
55
Error,
6+
String,
67
} = primordials;
78

89
const assert = require('internal/assert');

0 commit comments

Comments
 (0)