Share your code. Components are building blocks, you are the architect.

utils/take-last-while
v1.0.0
1.0.0
MIT
PUBLIC
0
0     DEPENDENCIES
Build: none
BuildNone
Returns a new list containing the last `n` elements of a given list, passing

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/take-last-while in your project
npm i @bit/bit.ramda.utils.take-last-while
Copied

takeLastWhile (fn:Function, xs:Array) : Array

Returns a new list containing the last n elements of a given list, passing each value to the supplied predicate function, and terminating when the predicate function returns false. Excludes the element that caused the predicate function to fail. The predicate function is passed one argument: (value).

Example

var isNotOne = x => x !== 1;

     R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4]

     R.takeLastWhile(x => x !== 'R' , 'Ramda'); //=> 'amda'

Arguments

fn: Function

The function called per iteration.

xs: Array

The collection to iterate over.

Returns

Array

A new array.