Skip to content

Commit

Permalink
fix build error in node10
Browse files Browse the repository at this point in the history
  • Loading branch information
mistlog committed Jan 16, 2021
1 parent af9db4e commit eee962e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-peg",
"version": "0.1.3",
"version": "0.1.4",
"description": "A react style parser generator, based on PEG.js",
"keywords": [
"react",
Expand Down
3 changes: 2 additions & 1 deletion src/translator/built-in/or.ts
Expand Up @@ -4,7 +4,8 @@ import { translateChildren } from "../common/pattern";

export class OrTranslator extends Translator {
translate(chunk: Chunk, actions: Map<string, Function>) {
chunk.children = chunk.children.flat();
// TODO: use Array.flat
chunk.children = [].concat(...chunk.children);
const expression = translateChildren(chunk, actions).join(" / ");
const pattern = `(${expression})`;
return pattern;
Expand Down

0 comments on commit eee962e

Please sign in to comment.