Skip to content

Commit 2c9a98a

Browse files
committed
Replace flatMap with reduce
1 parent 24a92df commit 2c9a98a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/remark-slate.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ function createSlateNode(
6767
case "strong":
6868
case "delete": {
6969
const { type, children } = node;
70-
return children.flatMap((n) =>
71-
createSlateNode(n, { ...decoration, [type]: true })
72-
);
70+
return children.reduce<SlateNode[]>((acc, n) => {
71+
acc.push(...createSlateNode(n, { ...decoration, [type]: true }));
72+
return acc;
73+
}, []);
7374
}
7475
case "inlineCode": {
7576
const { type, value } = node;

0 commit comments

Comments
 (0)