• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NaturalIntelligence / fast-xml-parser / 4156981534

pending completion
4156981534

push

github

amit kumar gupta
Update package detail

692 of 741 branches covered (93.39%)

3 of 3 new or added lines in 2 files covered. (100.0%)

2376 of 2418 relevant lines covered (98.26%)

196233.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/xmlparser/xmlNode.js
1
'use strict';
2

3
class XmlNode{
4
  constructor(tagname) {
5
    this.tagname = tagname;
769✔
6
    this.child = []; //nested tags, text, cdata, comments in order
769✔
7
    this[":@"] = {}; //attributes map
769✔
8
  }
9
  add(key,val){
10
    // this.child.push( {name : key, val: val, isCdata: isCdata });
11
    if(key === "__proto__") key = "#__proto__";
439!
12
    this.child.push( {[key]: val });
439✔
13
  }
14
  addChild(node) {
15
    if(node.tagname === "__proto__") node.tagname = "#__proto__";
627!
16
    if(node[":@"] && Object.keys(node[":@"]).length > 0){
627✔
17
      this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
135✔
18
    }else{
19
      this.child.push( { [node.tagname]: node.child });
492✔
20
    }
21
  };
22
};
23

24

25
module.exports = XmlNode;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc