Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getChildren(node, options) {
if (options.mode === 'shallow' && typeof node.type === 'function') {
return null;
}
const children = compact(
childrenOfNode(node).map(n => internalNodeToJson(n, options)),
);
return children.length > 0 ? children : null;
}
function getChildren(node, options) {
const children = compact(
childrenOfNode(node).map(n => internalNodeToJson(n, options)),
);
if (children.length > 0) {
return children;
}
return null;
}