Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.

Commit 6bcac77

Browse files
committed
Update flatmap to prefer array flatmap when present.
discord-akairo@d67c023
1 parent eeb14cc commit 6bcac77

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/util/Util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class Util {
4040
}
4141

4242
static flatMap(xs, f) {
43+
if (Array.prototype.flatMap) {
44+
return xs.flatMap(i => f(i));
45+
}
46+
4347
const res = [];
4448
for (const x of xs) {
4549
res.push(...f(x));

0 commit comments

Comments
 (0)