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

NaturalIntelligence / fast-xml-parser / 15517131831

08 Jun 2025 08:04AM UTC coverage: 97.547%. Remained the same
15517131831

push

github

amitguptagwl
deprecate in-built CLI

1105 of 1147 branches covered (96.34%)

8908 of 9132 relevant lines covered (97.55%)

390591.26 hits per line

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

70.59
/src/util.js
1
'use strict';
5✔
2

5✔
3
const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
5✔
4
const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
5✔
5
export const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';
5✔
6
const regexName = new RegExp('^' + nameRegexp + '$');
5✔
7

5✔
8
export function getAllMatches(string, regex) {
5✔
9
  const matches = [];
13,826,805✔
10
  let match = regex.exec(string);
13,826,805✔
11
  while (match) {
13,826,805✔
12
    const allmatches = [];
2,421,465✔
13
    allmatches.startIndex = regex.lastIndex - match[0].length;
2,421,465✔
14
    const len = match.length;
2,421,465✔
15
    for (let index = 0; index < len; index++) {
2,421,465✔
16
      allmatches.push(match[index]);
19,367,520✔
17
    }
19,367,520✔
18
    matches.push(allmatches);
2,421,465✔
19
    match = regex.exec(string);
2,421,465✔
20
  }
2,421,465✔
21
  return matches;
13,826,805✔
22
}
13,826,805✔
23

5✔
24
export const isName = function(string) {
5✔
25
  const match = regexName.exec(string);
29,380,230✔
26
  return !(match === null || typeof match === 'undefined');
29,380,230✔
27
}
29,380,230✔
28

5✔
29
export function isExist(v) {
5✔
30
  return typeof v !== 'undefined';
1,010✔
31
}
1,010✔
32

5✔
33
export function isEmptyObject(obj) {
5✔
34
  return Object.keys(obj).length === 0;
×
35
}
×
36

5✔
37
/**
5✔
38
 * Copy all the properties of a into b.
5✔
39
 * @param {*} target
5✔
40
 * @param {*} a
5✔
41
 */
5✔
42
export function merge(target, a, arrayMode) {
5✔
43
  if (a) {
×
44
    const keys = Object.keys(a); // will return an array of own properties
×
45
    const len = keys.length; //don't make it inline
×
46
    for (let i = 0; i < len; i++) {
×
47
      if (arrayMode === 'strict') {
×
48
        target[keys[i]] = [ a[keys[i]] ];
×
49
      } else {
×
50
        target[keys[i]] = a[keys[i]];
×
51
      }
×
52
    }
×
53
  }
×
54
}
×
55
/* exports.merge =function (b,a){
5✔
56
  return Object.assign(b,a);
5✔
57
} */
5✔
58

5✔
59
export function getValue(v) {
5✔
60
  if (exports.isExist(v)) {
×
61
    return v;
×
62
  } else {
×
63
    return '';
×
64
  }
×
65
}
×
66

5✔
67
// const fakeCall = function(a) {return a;};
5✔
68
// const fakeCallNoReturn = function() {};
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

© 2025 Coveralls, Inc