Skip to content

Commit 65f1e76

Browse files
committed
Remove reduce in Playground flags string construction
1 parent 7413415 commit 65f1e76

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/common/WarningFlagDescription.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,10 @@ function merge(base, other) {
483483
}
484484

485485
function tokensToString(tokens) {
486-
return Belt_Array.reduce(tokens, "", (function (acc, token) {
486+
return tokens.map(function (token) {
487487
var modifier = token.enabled ? "+" : "-";
488-
return acc + (modifier + token.flag);
489-
}));
488+
return modifier + token.flag;
489+
}).join("");
490490
}
491491

492492
var Parser = {

src/common/WarningFlagDescription.res

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,12 @@ module Parser = {
280280
}
281281

282282
// Creates a compiler compatible warning flag string
283-
let tokensToString = (tokens: array<token>): string =>
284-
Belt.Array.reduce(tokens, "", (acc, token) => {
283+
let tokensToString = tokens => {
284+
tokens
285+
->Js.Array2.map(token => {
285286
let modifier = token.enabled ? "+" : "-"
286-
287-
acc ++ (modifier ++ token.flag)
287+
modifier ++ token.flag
288288
})
289+
->Js.Array2.joinWith("")
290+
}
289291
}

0 commit comments

Comments
 (0)