Function listChildren

Lists the children of the given node into a new array.

import {listChildren, VariableName} from "estree-sentry";
// returns: [
// { type: "Identifier", name: "x" },
// { type: "Identifier", name: "y" },
// ]
listChildren({
type: "BinaryExpression",
operator: "+",
left: {
type: "Identifier",
name: "x" as VariableName,
},
right: {
type: "Identifier",
name:"y" as VariableName,
},
});
  • Type Parameters

    • A

      The annotation type.

    Parameters

    • node: Node<A>

      The parent node.

    Returns Node<A>[]

    The children of the parent node.