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

utils/drop-last-while
v1.1.0
1.1.0
1.0.0
Returns a new list excluding all the tailing elements of a given list which

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/drop-last-while in your project
npm i @bit/bit.ramda.utils.drop-last-while
Copied

dropLastWhile (predicate:Function, xs:Array) : Array

Returns a new list excluding all the tailing elements of a given list which satisfy the supplied predicate function. It passes each value from the right to the supplied predicate function, skipping elements until the predicate function returns a falsy value. The predicate function is applied to one argument: (value).

Acts as a transducer if a transformer is given in list position.

Example

var lteThree = x => x <= 3;

     R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]

     R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd'

Arguments

predicate: Function

The function to be called on each element

xs: Array

The collection to iterate over.

Returns

Array

A new array without any trailing elements that return `falsy` values from the `predicate`.