take

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
5
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
1 KB
Returns the first `n` elements of the given list, string, or transducer/transformer (or object with a `take` method).
1 contributor
Install take as a package?
Copied
npm i @bit/justin-capalbo.ramda.take
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
take (
n:Number,
list:*
) : *

Returns the first n elements of the given list, string, or transducer/transformer (or object with a take method).

Dispatches to the take method of the second argument, if present.

Example
R.take(1, ['foo', 'bar', 'baz']); //=> ['foo']
     R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
     R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
     R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
     R.take(3, 'ramda');               //=> 'ram'

     const personnel = [
       'Dave Brubeck',
       'Paul Desmond',
       'Eugene Wright',
       'Joe Morello',
       'Gerry Mulligan',
       'Bob Bates',
       'Joe Dodge',
       'Ron Crotty'
     ];

     const takeFive = R.take(5);
     takeFive(personnel);
     //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan']
Arguments
n: Number
list: *
Returns
*

Help and resources