1 contributor
Like
Install split-when as a package?
Copied
npm i @bit/justin-capalbo.ramda.split-when
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
splitWhen (
pred:
Function
,list:
) : Array
Array
Takes a list and a predicate and returns a pair of lists with the following properties:
- the result of concatenating the two output lists is equivalent to the input list;
- none of the elements of the first output list satisfies the predicate; and
- if the second output list is non-empty, its first element satisfies the predicate.
Example
Arguments
pred:
Function
The predicate that determines where the array is split.
list:
Array
The array to be split.
Returns
Array