/** * @typedef {import('unist').Parent} Parent */ /** * @template {Parent} Kind * Node type. * @callback Visitor * Callback called for each `child` in `parent` later given to `visit`. * @param {Kind['children'][number]} child * Child of parent. * @param {number} index * Position of `child` in parent. * @param {Kind} parent * Parent node. * @returns {undefined} * Nothing. */ /** * @template {Parent} Kind * Node type. * @callback Visit * Function to call the bound `visitor` for each child in `parent`. * @param {Kind} node * Parent node. * @returns {undefined} * Nothing. */ /** * Wrap `visitor` to be called for each child in the nodes later given to * `visit`. * * @template {Parent} Kind * Node type. * @param {Visitor} visitor * Callback called for each `child` in `parent` later given to `visit`. * @returns {Visit} * Function to call the bound `visitor` for each child in `parent`. */ export function visitChildren(visitor: Visitor): Visit; export type Parent = import('unist').Parent; /** * Callback called for each `child` in `parent` later given to `visit`. */ export type Visitor = (child: Kind['children'][number], index: number, parent: Kind) => undefined; /** * Function to call the bound `visitor` for each child in `parent`. */ export type Visit = (node: Kind) => undefined;