Skip to content

Commit

Permalink
removed mergeRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Jun 17, 2023
1 parent 242dfb7 commit b9f0240
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
21 changes: 0 additions & 21 deletions src/utils/utils.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,6 @@ const utils = {
return false;
},

// This function takes in an array of number pairs and combines where there's overlap
mergeRanges(ranges) {
const numberOfRanges = ranges.length;
if (numberOfRanges > 0) {
const firstRange = ranges[0];
let previousEnd = firstRange[1];
const result = [firstRange];
for (let i = 1; i < numberOfRanges; i++) {
const tempRange = ranges[i];
const [start, end] = tempRange;
if (start <= previousEnd) {
result[result.length - 1][1] = end;
} else {
result.push(tempRange);
}
previousEnd = end;
}
return result;
}
},

isEsriJson(input, debug = false) {
if (debug) console.log("starting isEsriJson with", input);
const inputType = typeof input;
Expand Down
20 changes: 0 additions & 20 deletions src/utils/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,6 @@ test("Test Forcing Within", ({ eq }) => {
eq(utils.forceWithin(990, 1, 11), 11);
});

test("Test Merging of Index Ranges", ({ eq }) => {
let original = [
[0, 10],
[10, 10],
[20, 30],
[30, 40]
];
let merged = utils.mergeRanges(original);
eq(JSON.stringify(merged), "[[0,10],[20,40]]");

original = [
[0, 10],
[10, 10],
[21, 31],
[30, 40]
];
merged = utils.mergeRanges(original);
eq(JSON.stringify(merged), "[[0,10],[21,40]]");
});

test("Get Depth For Multipolygon", async ({ eq }) => {
const countryDepths = [
["Afghanistan", 3],
Expand Down

0 comments on commit b9f0240

Please sign in to comment.