llmxml
Version:
Convert between markdown and LLM-friendly pseudo-XML
17 lines • 495 B
JavaScript
/**
* Creates an AST node with the given type, data and location information.
* @param {string} type - The type of node ('tag' or 'text')
* @param {object} data - The node data (attributes, children, value, etc.)
* @param {object} location - Source location information from the parser
* @returns {object} The AST node
*/
export function createNode(type, data, location) {
return {
type,
...data,
location: {
start: location.start,
end: location.end
}
};
}