Skip to content

Commit

Permalink
topojson#35 Make stitchedArcs a Set.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfrances107 committed Aug 21, 2022
1 parent 71e5bd6 commit 531ca87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stitch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function(topology, arcs) {
var stitchedArcs = {},
var stitchedArcs = new Set,
fragmentByStart = {},
fragmentByEnd = {},
fragments = [],
Expand Down Expand Up @@ -60,14 +60,14 @@ export default function(topology, arcs) {
delete fragmentByStart[f.start];
delete f.start;
delete f.end;
f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });
f.forEach(function(i) { stitchedArcs.add(i < 0 ? ~i : i); });
fragments.push(f);
}
}

flush(fragmentByEnd, fragmentByStart);
flush(fragmentByStart, fragmentByEnd);
arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });
arcs.forEach(function(i) { if (!stitchedArcs.has(i < 0 ? ~i : i)) fragments.push([i]); });

return fragments;
}

0 comments on commit 531ca87

Please sign in to comment.