Skip to content

Commit

Permalink
lib: replace Map global by the primordials
Browse files Browse the repository at this point in the history
PR-URL: #31155
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Sebastien-Ahkrin authored and targos committed Jan 6, 2020

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
1 parent f268621 commit 20ecb5d
Showing 23 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@ rules:
message: "Use `const { Error } = primordials;` instead of the global."
- name: JSON
message: "Use `const { JSON } = primordials;` instead of the global."
- name: Map
message: "Use `const { Map } = primordials;` instead of the global."
- name: Math
message: "Use `const { Math } = primordials;` instead of the global."
- name: Number
1 change: 1 addition & 0 deletions lib/assert.js
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ const {
ObjectIs,
ObjectKeys,
ObjectPrototypeIsPrototypeOf,
Map,
RegExpPrototypeTest,
} = primordials;

1 change: 1 addition & 0 deletions lib/domain.js
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
const {
Array,
Error,
Map,
ObjectDefineProperty,
ReflectApply,
Symbol,
1 change: 1 addition & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
'use strict';

const {
Map,
MathMax,
NumberIsSafeInteger,
ObjectCreate,
1 change: 1 addition & 0 deletions lib/inspector.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
const {
JSONParse,
JSONStringify,
Map,
Symbol,
} = primordials;

3 changes: 2 additions & 1 deletion lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
@@ -45,11 +45,12 @@

const {
Error,
ReflectGet,
Map,
ObjectCreate,
ObjectDefineProperty,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectGet,
SafeSet,
} = primordials;

1 change: 1 addition & 0 deletions lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Map,
ObjectDefineProperty,
SafeWeakMap,
} = primordials;
1 change: 1 addition & 0 deletions lib/internal/cluster/child.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Map,
ObjectAssign,
} = primordials;

1 change: 1 addition & 0 deletions lib/internal/cluster/master.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Map,
ObjectKeys,
ObjectValues,
} = primordials;
1 change: 1 addition & 0 deletions lib/internal/cluster/round_robin_handle.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

const {
Boolean,
Map,
} = primordials;

const assert = require('internal/assert');
4 changes: 4 additions & 0 deletions lib/internal/cluster/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

const {
Map,
} = primordials;

module.exports = {
sendHelper,
internal
1 change: 1 addition & 0 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ const {
ArrayIsArray,
Boolean,
Error,
Map,
MathFloor,
Number,
ObjectDefineProperties,
1 change: 1 addition & 0 deletions lib/internal/encoding.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
// https://encoding.spec.whatwg.org

const {
Map,
ObjectCreate,
ObjectDefineProperties,
ObjectGetOwnPropertyDescriptors,
1 change: 1 addition & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
const {
ArrayIsArray,
Error,
Map,
MathAbs,
NumberIsInteger,
ObjectDefineProperty,
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
const {
ArrayFrom,
ArrayIsArray,
Map,
MathMin,
ObjectAssign,
ObjectCreate,
1 change: 1 addition & 0 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ const {
ArrayIsArray,
Error,
JSONParse,
Map,
ObjectCreate,
ObjectDefineProperty,
ObjectFreeze,
4 changes: 4 additions & 0 deletions lib/internal/process/signal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

const {
Map,
} = primordials;

const {
errnoException,
} = require('internal/errors');
1 change: 1 addition & 0 deletions lib/internal/source_map/source_map_cache.js
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ const {
ObjectKeys,
ObjectGetOwnPropertyDescriptor,
ObjectPrototypeHasOwnProperty,
Map,
MapPrototypeEntries,
WeakMap,
WeakMapPrototypeGet,
1 change: 1 addition & 0 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ const {
ArrayFrom,
ArrayIsArray,
Error,
Map,
ObjectCreate,
ObjectDefineProperties,
ObjectDefineProperty,
1 change: 1 addition & 0 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ const {
BooleanPrototypeValueOf,
DatePrototypeGetTime,
Error,
Map,
NumberIsNaN,
NumberPrototypeValueOf,
ObjectGetOwnPropertySymbols,
1 change: 1 addition & 0 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ const {
DatePrototypeToString,
ErrorPrototypeToString,
JSONStringify,
Map,
MapPrototype,
MapPrototypeEntries,
MathFloor,
1 change: 1 addition & 0 deletions lib/perf_hooks.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
const {
ArrayIsArray,
Boolean,
Map,
NumberIsSafeInteger,
ObjectDefineProperties,
ObjectDefineProperty,
1 change: 1 addition & 0 deletions lib/v8.js
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ const {
Int16Array,
Int32Array,
Int8Array,
Map,
ObjectPrototypeToString,
Symbol,
Uint16Array,

0 comments on commit 20ecb5d

Please sign in to comment.