drop-last

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
2 KB
Returns a list containing all but the last `n` elements of the given `list`.
1 contributor
Install drop-last as a package?
Copied
npm i @bit/justin-capalbo.ramda.drop-last
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
dropLast (
n:Number,
list:Array
) : Array

Returns a list containing all but the last n elements of the given list.

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

Example
R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
     R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
     R.dropLast(3, ['foo', 'bar', 'baz']); //=> []
     R.dropLast(4, ['foo', 'bar', 'baz']); //=> []
     R.dropLast(3, 'ramda');               //=> 'ra'
Arguments
n: Number

The number of elements of list to skip.

list: Array

The list of elements to consider.

Returns
Array

A copy of the list with only the first `list.length - n` elements

Help and resources