Split an array when a predicate function determines an element is a predicate (similiar to String.prototype.split but for arrays)
the array of groups split as per the splitFn
splitFn
const groups = splitArray([1, 3, 5, 6, 7, 9, 11], (x) => x % 2 === 0) // [[1, 3, 5], [7, 9, 11]]
the array to split
a function over elements in the array that determines whether an element is a delimeter.
Generated using TypeDoc
Split an array when a predicate function determines an element is a predicate (similiar to String.prototype.split but for arrays)
Returns
the array of groups split as per the
splitFn
Example