Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getParagraphText(node) {
return traverse.reduce(
node.children,
(text, node) => (isTextNode(node) ? text + node.value : text),
''
);
}
function getBody(nodes) {
return traverse.reduce(
nodes,
(ps, node) => {
return isParagraphNode(node) ? [...ps, getParagraphText(node)] : ps;
},
[]
);
}