• Splits the array every time the given predicate fires. The element the split appears on will not be included!

    Type Parameters

    • T

    Parameters

    • arr: readonly T[]
    • predicate: (elem: T) => boolean

    Returns T[][]

    splitArrayOn(['a', '', 'b', '', '', 'c'], elem => elem === '')
    // => [['a'], ['b'], [], ['c']]
    splitArrayOn([1,2,3], elem => true)
    // => [[], [], [], []]