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

NaturalIntelligence / fast-xml-parser / 22012305802

14 Feb 2026 05:53AM UTC coverage: 97.755% (+0.1%) from 97.617%
22012305802

push

github

amitguptagwl
update release info

1275 of 1319 branches covered (96.66%)

9753 of 9977 relevant lines covered (97.75%)

447181.27 hits per line

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

96.51
/src/xmlparser/OptionsBuilder.js
1
export const defaultOptions = {
5✔
2
  preserveOrder: false,
5✔
3
  attributeNamePrefix: '@_',
5✔
4
  attributesGroupName: false,
5✔
5
  textNodeName: '#text',
5✔
6
  ignoreAttributes: true,
5✔
7
  removeNSPrefix: false, // remove NS from tag name or attribute name if true
5✔
8
  allowBooleanAttributes: false, //a tag can have attributes without any value
5✔
9
  //ignoreRootElement : false,
5✔
10
  parseTagValue: true,
5✔
11
  parseAttributeValue: false,
5✔
12
  trimValues: true, //Trim string values of tag and attributes
5✔
13
  cdataPropName: false,
5✔
14
  numberParseOptions: {
5✔
15
    hex: true,
5✔
16
    leadingZeros: true,
5✔
17
    eNotation: true
5✔
18
  },
5✔
19
  tagValueProcessor: function (tagName, val) {
5✔
20
    return val;
2,180✔
21
  },
5✔
22
  attributeValueProcessor: function (attrName, val) {
5✔
23
    return val;
1,225✔
24
  },
5✔
25
  stopNodes: [], //nested tags will not be parsed even for errors
5✔
26
  alwaysCreateTextNode: false,
5✔
27
  isArray: () => false,
5✔
28
  commentPropName: false,
5✔
29
  unpairedTags: [],
5✔
30
  processEntities: true,
5✔
31
  htmlEntities: false,
5✔
32
  ignoreDeclaration: false,
5✔
33
  ignorePiTags: false,
5✔
34
  transformTagName: false,
5✔
35
  transformAttributeName: false,
5✔
36
  updateTag: function (tagName, jPath, attrs) {
5✔
37
    return tagName
3,740✔
38
  },
5✔
39
  // skipEmptyListItem: false
5✔
40
  captureMetaData: false,
5✔
41
};
5✔
42

5✔
43
/**
5✔
44
 * Normalizes processEntities option for backward compatibility
5✔
45
 * @param {boolean|object} value 
5✔
46
 * @returns {object} Always returns normalized object
5✔
47
 */
5✔
48
function normalizeProcessEntities(value) {
1,030✔
49
  // Boolean backward compatibility
1,030✔
50
  if (typeof value === 'boolean') {
1,030✔
51
    return {
915✔
52
      enabled: value, // true or false
915✔
53
      maxEntitySize: 10000,
915✔
54
      maxExpansionDepth: 10,
915✔
55
      maxTotalExpansions: 1000,
915✔
56
      maxExpandedLength: 100000,
915✔
57
      allowedTags: null,
915✔
58
      tagFilter: null
915✔
59
    };
915✔
60
  }
915✔
61

115✔
62
  // Object config - merge with defaults
115✔
63
  if (typeof value === 'object' && value !== null) {
1,030✔
64
    return {
115✔
65
      enabled: value.enabled !== false, // default true if not specified
115✔
66
      maxEntitySize: value.maxEntitySize ?? 10000,
115✔
67
      maxExpansionDepth: value.maxExpansionDepth ?? 10,
115✔
68
      maxTotalExpansions: value.maxTotalExpansions ?? 1000,
115✔
69
      maxExpandedLength: value.maxExpandedLength ?? 100000,
115✔
70
      allowedTags: value.allowedTags ?? null,
115✔
71
      tagFilter: value.tagFilter ?? null
115✔
72
    };
115✔
73
  }
115✔
74

×
75
  // Default to enabled with limits
×
76
  return normalizeProcessEntities(true);
×
77
}
1,030✔
78

5✔
79
export const buildOptions = function (options) {
5✔
80
  const built = Object.assign({}, defaultOptions, options);
1,030✔
81

1,030✔
82
  // Always normalize processEntities for backward compatibility and validation
1,030✔
83
  built.processEntities = normalizeProcessEntities(built.processEntities);
1,030✔
84
  //console.debug(built.processEntities)
1,030✔
85
  return built;
1,030✔
86
};
5✔
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

© 2026 Coveralls, Inc