{"version":3,"file":"index.cjs","names":[],"sources":["../index.ts"],"sourcesContent":["import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\n\n/**\n * Updates the `._renderInfo` property on a node to include\n * whatever has been supplied to `renderInfo`. If `renderInfo`\n * is null, no update is performed.\n *\n * *This operation mutates `node`*\n */\nexport function updateRenderInfo(\n    node: Ast.Node | Ast.Argument,\n    renderInfo: object | null | undefined\n) {\n    if (renderInfo != null) {\n        node._renderInfo = { ...(node._renderInfo || {}), ...renderInfo };\n    }\n    return node;\n}\n\n/**\n * Removes any `_renderInfo` and `position` tags present in the AST. This\n * operation is _destructive_.\n */\nexport function trimRenderInfo<T extends Ast.Ast>(ast: T) {\n    visit(ast, (node) => {\n        delete node._renderInfo;\n        delete node.position;\n    });\n    return ast;\n}\n\n// NOTE: The docstring comment must be the last item in the index.ts file!\n/**\n * ## What is this?\n *\n * Functions to help modify the `_renderInfo` of a `unified-latex` Abstract Syntax Tree (AST).\n *\n * ## When should I use this?\n *\n * If you want to compare the structure of an AST without position information or extra information\n * that is kept for pretty-printing, these functions can be used to remove/modify the `_renderInfo`\n * of an `Ast.Node`.\n */\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,iBACZ,MACA,YACF;AACE,KAAI,cAAc,KACd,MAAK,cAAc;EAAE,GAAI,KAAK,eAAe,EAAE;EAAG,GAAG;EAAY;AAErE,QAAO;;;;;;AAOX,SAAgB,eAAkC,KAAQ;AACtD,EAAA,GAAA,wCAAA,OAAM,MAAM,SAAS;AACjB,SAAO,KAAK;AACZ,SAAO,KAAK;GACd;AACF,QAAO"}