src/language-yaml/utils.js/mapNode
function mapNode(node, callback, parent) {
  return callback(
    "children" in node
      ? {
          ...node,
          children: node.children.map((childNode) =>
            mapNode(childNode, callback, node)
          ),
        }
      : node,
    parent
  );
}