MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / buildRanges

Method buildRanges

xs/tools/unicode/strings.js:59–77  ·  view source on GitHub ↗
(singles)

Source from the content-addressed store, hash-verified

57 this.report("};");
58 }
59 buildRanges(singles) {
60 let ranges = [];
61 let length = singles.length;
62 if (length > 0) {
63 let former = singles[0];
64 ranges.push(former);
65 for (let i = 1; i < length; i++) {
66 let single = singles[i];
67 former++;
68 if (single != former) {
69 ranges.push(former);
70 ranges.push(single);
71 }
72 former = single;
73 }
74 ranges.push(former + 1);
75 }
76 return ranges;
77 }
78 run() {
79 let once = true;
80 let tool = this;

Callers 1

runMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected