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>
  • Loading branch information
Sebastien-Ahkrin authored and targos committed Jan 6, 2020
1 parent f268621 commit 20ecb5d
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/assert.js
Expand Up @@ -26,6 +26,7 @@ const {
ObjectIs,
ObjectKeys,
ObjectPrototypeIsPrototypeOf,
Map,
RegExpPrototypeTest,
} = primordials;

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

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

Expand Down
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/loaders.js
Expand Up @@ -45,11 +45,12 @@

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

Expand Down
1 change: 1 addition & 0 deletions lib/internal/bootstrap/pre_execution.js
@@ -1,6 +1,7 @@
'use strict';

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

const {
Map,
ObjectAssign,
} = primordials;

Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/master.js
@@ -1,6 +1,7 @@
'use strict';

const {
Map,
ObjectKeys,
ObjectValues,
} = primordials;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/round_robin_handle.js
Expand Up @@ -2,6 +2,7 @@

const {
Boolean,
Map,
} = primordials;

const assert = require('internal/assert');
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/cluster/utils.js
@@ -1,5 +1,9 @@
'use strict';

const {
Map,
} = primordials;

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

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

const {
Map,
} = primordials;

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

0 comments on commit 20ecb5d

Please sign in to comment.