Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: use <array>.push and <array>.unshift instead of <array>.concat #37239

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'use strict';

const {
ArrayPrototypeConcat,
ArrayPrototypePushApply,
MathMin,
Symbol,
RegExpPrototypeTest,
Expand Down Expand Up @@ -66,7 +66,7 @@ function parserOnHeaders(headers, url) {
// Once we exceeded headers limit - stop collecting them
if (this.maxHeaderPairs <= 0 ||
this._headers.length < this.maxHeaderPairs) {
this._headers = ArrayPrototypeConcat(this._headers, headers);
ArrayPrototypePushApply(this._headers, headers);
}
this._url += url;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/main/worker_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// message port.

const {
ArrayPrototypeConcat,
ArrayPrototypeForEach,
ArrayPrototypePushApply,
ArrayPrototypeSplice,
ObjectDefineProperty,
PromisePrototypeCatch,
Expand Down Expand Up @@ -126,7 +126,7 @@ port.on('message', (message) => {
loadPreloadModules();
initializeFrozenIntrinsics();
if (argv !== undefined) {
process.argv = ArrayPrototypeConcat(process.argv, argv);
ArrayPrototypePushApply(process.argv, argv);
}
publicWorker.parentPort = publicPort;
publicWorker.workerData = workerData;
Expand Down
7 changes: 4 additions & 3 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const {
ArrayPrototypeSlice,
ArrayPrototypeSplice,
ArrayPrototypeUnshift,
ArrayPrototypeUnshiftApply,
Boolean,
Error,
JSONParse,
Expand Down Expand Up @@ -1204,18 +1205,18 @@ Module._initPaths = function() {
path.resolve(process.execPath, '..') :
path.resolve(process.execPath, '..', '..');

let paths = [path.resolve(prefixDir, 'lib', 'node')];
const paths = [path.resolve(prefixDir, 'lib', 'node')];

if (homeDir) {
ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));
ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_modules'));
}

if (nodePath) {
paths = ArrayPrototypeConcat(ArrayPrototypeFilter(
ArrayPrototypeUnshiftApply(paths, ArrayPrototypeFilter(
StringPrototypeSplit(nodePath, path.delimiter),
Boolean
), paths);
));
}

modulePaths = paths;
Expand Down