take-last-while

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
1 KB
Returns a new list containing the last `n` elements of a given list, passing
1 contributor
Install take-last-while as a package?
Copied
npm i @bit/justin-capalbo.ramda.take-last-while
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
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
const 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.

Help and resources