Skip to content

Commit 0dd8605

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace Map global by the primordials
PR-URL: #31155 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 02ed713 commit 0dd8605

23 files changed

+28
-1
lines changed

lib/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ rules:
1919
message: "Use `const { Error } = primordials;` instead of the global."
2020
- name: JSON
2121
message: "Use `const { JSON } = primordials;` instead of the global."
22+
- name: Map
23+
message: "Use `const { Map } = primordials;` instead of the global."
2224
- name: Math
2325
message: "Use `const { Math } = primordials;` instead of the global."
2426
- name: Number

lib/assert.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
ObjectAssign,
2626
ObjectIs,
2727
ObjectKeys,
28+
Map,
2829
} = primordials;
2930

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

lib/domain.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
const {
3030
Array,
3131
Error,
32+
Map,
3233
ObjectDefineProperty,
3334
ReflectApply,
3435
Symbol,

lib/fs.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'use strict';
2626

2727
const {
28+
Map,
2829
MathMax,
2930
NumberIsSafeInteger,
3031
ObjectCreate,

lib/inspector.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const {
44
JSONParse,
55
JSONStringify,
6+
Map,
67
Symbol,
78
} = primordials;
89

lib/internal/bootstrap/loaders.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545

4646
const {
4747
Error,
48-
ReflectGet,
48+
Map,
4949
ObjectCreate,
5050
ObjectDefineProperty,
5151
ObjectKeys,
5252
ObjectPrototypeHasOwnProperty,
53+
ReflectGet,
5354
SafeSet,
5455
} = primordials;
5556

lib/internal/bootstrap/pre_execution.js

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

33
const {
4+
Map,
45
ObjectDefineProperty,
56
SafeWeakMap,
67
} = primordials;

lib/internal/cluster/child.js

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

33
const {
4+
Map,
45
ObjectAssign,
56
} = primordials;
67

lib/internal/cluster/master.js

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

33
const {
4+
Map,
45
ObjectKeys,
56
ObjectValues,
67
} = primordials;

lib/internal/cluster/round_robin_handle.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {
44
Boolean,
5+
Map,
56
} = primordials;
67

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

lib/internal/cluster/utils.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
22

3+
const {
4+
Map,
5+
} = primordials;
6+
37
module.exports = {
48
sendHelper,
59
internal

lib/internal/console/constructor.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
ArrayIsArray,
99
Boolean,
1010
Error,
11+
Map,
1112
ObjectDefineProperties,
1213
ObjectDefineProperty,
1314
ObjectKeys,

lib/internal/encoding.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// https://encoding.spec.whatwg.org
55

66
const {
7+
Map,
78
ObjectCreate,
89
ObjectDefineProperties,
910
ObjectGetOwnPropertyDescriptors,

lib/internal/errors.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
const {
1414
ArrayIsArray,
1515
Error,
16+
Map,
1617
MathAbs,
1718
NumberIsInteger,
1819
ObjectDefineProperty,

lib/internal/http2/core.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const {
66
ArrayFrom,
77
ArrayIsArray,
8+
Map,
89
MathMin,
910
ObjectAssign,
1011
ObjectCreate,

lib/internal/modules/cjs/loader.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
ArrayIsArray,
2626
Error,
2727
JSONParse,
28+
Map,
2829
ObjectCreate,
2930
ObjectDefineProperty,
3031
ObjectFreeze,

lib/internal/process/main_thread_only.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
const {
77
ArrayIsArray,
8+
Map,
89
} = primordials;
910

1011
const {

lib/internal/source_map/source_map_cache.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {
66
ObjectKeys,
77
ObjectGetOwnPropertyDescriptor,
88
ObjectPrototypeHasOwnProperty,
9+
Map,
910
MapPrototypeEntries,
1011
WeakMap,
1112
WeakMapPrototypeGet,

lib/internal/util.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const {
44
ArrayFrom,
55
ArrayIsArray,
66
Error,
7+
Map,
78
ObjectCreate,
89
ObjectDefineProperties,
910
ObjectDefineProperty,

lib/internal/util/comparisons.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {
66
BooleanPrototypeValueOf,
77
DatePrototypeGetTime,
88
Error,
9+
Map,
910
NumberIsNaN,
1011
NumberPrototypeValueOf,
1112
ObjectGetOwnPropertySymbols,

lib/internal/util/inspect.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
DatePrototypeToString,
1111
ErrorPrototypeToString,
1212
JSONStringify,
13+
Map,
1314
MapPrototypeEntries,
1415
MathFloor,
1516
MathMax,

lib/perf_hooks.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const {
44
ArrayIsArray,
55
Boolean,
6+
Map,
67
NumberIsSafeInteger,
78
ObjectDefineProperties,
89
ObjectDefineProperty,

lib/v8.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const {
2323
Int16Array,
2424
Int32Array,
2525
Int8Array,
26+
Map,
2627
ObjectPrototypeToString,
2728
Symbol,
2829
Uint16Array,

0 commit comments

Comments
 (0)