Skip to content

Commit 9fe44eb

Browse files
committed
Push into an array instead of creating a new on every --define
1 parent f043bb7 commit 9fe44eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/cmake-rn/src/cli.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const defineOption = new Option(
8989
"-D,--define <entry...>",
9090
"Define cache variables passed when configuring projects",
9191
)
92-
.argParser<Record<string, string>[]>((input, previous = []) => {
92+
.argParser<Record<string, string>[]>((input, previous) => {
9393
// TODO: Implement splitting of value using a regular expression (using named groups) for the format <var>[:<type>]=<value>
9494
// and return an object keyed by variable name with the string value as value or alternatively an array of [value, type]
9595
const match = input.match(
@@ -101,7 +101,8 @@ const defineOption = new Option(
101101
);
102102
}
103103
const { name, type, value } = match.groups;
104-
return [...previous, { [type ? `${name}:${type}` : name]: value }];
104+
previous.push({ [type ? `${name}:${type}` : name]: value });
105+
return previous;
105106
})
106107
.default([]);
107108

0 commit comments

Comments
 (0)