Skip to content

Instantly share code, notes, and snippets.

@linusnorton
Last active November 16, 2016 20:13
Show Gist options
  • Save linusnorton/32abdaa51058e768175a3163ff8d9921 to your computer and use it in GitHub Desktop.
Save linusnorton/32abdaa51058e768175a3163ff8d9921 to your computer and use it in GitHub Desktop.
for (const [stoppingPattern, trips] of tripsByStoppingPattern) {
const lines = linesByStoppingPattern.get(stoppingPattern, []);
for (const trip of trips) {
this.getLineForTrip(trip, lines).match({
some: line => line.add(trip),
none: () => lines.push(new Line([trip]))
});
linesByStoppingPattern = linesByStoppingPattern.set(stoppingPattern, lines);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment