• slice an array (or string) at the provided flattened 2-tuple of interval indexes.

    Type Parameters

    • T extends string | any[]

    Parameters

    Returns T[]

    Example

    const arr = Array(100).map((v, i) => i) // === [0, 1, 2, ..., 99]
    const slices: Intervals = [0, 10, 20, 30, 90, undefined, 15, -15]
    sliceIntervals(arr, slices) // === [[0, 1, 2, ..., 9], [20, 21, ..., 29], [90, ..., 99], [15, ..., 84]]

Generated using TypeDoc