Splits the given range into subranges by excluding the given used ranged.

Type signature

(used: [number, number][], sourceRange?: number[]) => (range: [number, number]) => [number, number][];
export default split

Examples

split([
  [2, 3],
  [5, 7],
]);
// ⇒ [[0, 2], [3, 5], [7, 10]]
Try in REPL

Questions

  • How to split a range into subranges?

TypeScript sourceJavaScript source