diff --git a/src/models/node.js b/src/models/node.js index 06c6c92eb..b93efac1c 100644 --- a/src/models/node.js +++ b/src/models/node.js @@ -280,9 +280,14 @@ const Node = { getBlocksByTypeAsArray(type) { return this.nodes.reduce((array, node) => { - if (node.kind != 'block') return array - if (node.isLeafBlock() && node.type == type) return array.push(node) - return array.concat(node.getBlocksByTypeAsArray(type)) + if (node.kind != 'block') { + return array + } else if (node.isLeafBlock() && node.type == type) { + array.push(node) + return array + } else { + return array.concat(node.getBlocksByTypeAsArray(type)) + } }, []) }, @@ -766,9 +771,14 @@ const Node = { getInlinesByTypeAsArray(type) { return this.nodes.reduce((inlines, node) => { - if (node.kind == 'text') return inlines - if (node.isLeafInline() && node.type == type) return inlines.push(node) - return inlines.concat(node.getInlinesByTypeAsArray(type)) + if (node.kind == 'text') { + return inlines + } else if (node.isLeafInline() && node.type == type) { + inlines.push(node) + return inlines + } else { + return inlines.concat(node.getInlinesByTypeAsArray(type)) + } }, []) },