push
travis-ci
3963 of 4325 branches covered (91.63%)
Branch coverage included in aggregate %.
16 of 16 new or added lines in 1 file covered. (100.0%)
7611 of 7952 relevant lines covered (95.71%)
1058594.72 hits per line
1 |
import nodeValueCache from './nodeValueCache'; |
3✔ |
2 |
|
|
3 |
function getNodeSubType(node) { |
|
4 |
switch (node.nodeType) {
|
814,772✔ |
5 |
case 2: |
|
6 |
return 'attribute()'; |
75,949✔ |
7 |
case 1: |
|
8 |
return 'element()'; |
368,565✔ |
9 |
case 3: |
|
10 |
case 4: // CDATA nodes are text too |
|
11 |
return 'text()'; |
366,243✔ |
12 |
case 7: |
|
13 |
return 'processing-instruction()'; |
500✔ |
14 |
case 8: |
|
15 |
return 'comment()'; |
617✔ |
16 |
case 9: |
|
17 |
return 'document()'; |
2,898✔ |
18 |
default:
|
|
19 |
return 'node()'; |
× |
20 |
} |
|
21 |
} |
|
22 |
|
|
23 |
export default function createNodeValue(node) { |
3✔ |
24 |
if (nodeValueCache.has(node)) {
|
|
25 |
return nodeValueCache.get(node);
|
83,350,080✔ |
26 |
} |
|
27 |
const nodeValue = { type: getNodeSubType(node), value: node }; |
814,772✔ |
28 |
nodeValueCache.set(node, nodeValue); |
814,772✔ |
29 |
return nodeValue;
|
814,772✔ |
30 |
} |