perf: partially replace .concat with .push (#13609)
This commit is contained in:
@@ -21,7 +21,11 @@ function collect(value, previousValue): Array<string> {
|
||||
|
||||
const values = value.split(",");
|
||||
|
||||
return previousValue ? previousValue.concat(values) : values;
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
program.option("-e, --eval [script]", "Evaluate script");
|
||||
@@ -197,7 +201,7 @@ if (program.eval || program.print) {
|
||||
}
|
||||
|
||||
// add back on node and concat the sliced args
|
||||
process.argv = ["node"].concat(args);
|
||||
process.argv = ["node", ...args];
|
||||
process.execArgv.push(fileURLToPath(import.meta.url));
|
||||
|
||||
Module.runMain();
|
||||
|
||||
@@ -8,7 +8,7 @@ import path from "path";
|
||||
import child_process from "child_process";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
let args = [
|
||||
const args = [
|
||||
path.join(path.dirname(fileURLToPath(import.meta.url)), "_babel-node"),
|
||||
];
|
||||
|
||||
@@ -69,7 +69,7 @@ getV8Flags(async function (err, v8Flags) {
|
||||
|
||||
// append arguments passed after --
|
||||
if (argSeparator > -1) {
|
||||
args = args.concat(userArgs);
|
||||
args.push(...userArgs);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user