Rocky_Mountain_Vending/.pnpm-store/v10/files/53/f5b99259bd8910e084d0d1f2a35de3731a3e9e6a0f3a5d688d90a786ef8c230999b9cae254b74cf589fc7f0b08d50da5c5fe6d71210e3f7820c7afa16fca22
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

40 lines
1.3 KiB
Text

'use strict';
let METADATA_SYMBOL;
if (typeof Symbol !== "function") {
METADATA_SYMBOL = "@@xmlMetadata";
} else {
METADATA_SYMBOL = Symbol("XML Node Metadata");
}
export default class XmlNode{
constructor(tagname) {
this.tagname = tagname;
this.child = []; //nested tags, text, cdata, comments in order
this[":@"] = {}; //attributes map
}
add(key,val){
// this.child.push( {name : key, val: val, isCdata: isCdata });
if(key === "__proto__") key = "#__proto__";
this.child.push( {[key]: val });
}
addChild(node, startIndex) {
if(node.tagname === "__proto__") node.tagname = "#__proto__";
if(node[":@"] && Object.keys(node[":@"]).length > 0){
this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
}else{
this.child.push( { [node.tagname]: node.child });
}
// if requested, add the startIndex
if (startIndex !== undefined) {
// Note: for now we just overwrite the metadata. If we had more complex metadata,
// we might need to do an object append here: metadata = { ...metadata, startIndex }
this.child[this.child.length - 1][METADATA_SYMBOL] = { startIndex };
}
}
/** symbol used for metadata */
static getMetaDataSymbol() {
return METADATA_SYMBOL;
}
}