Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

take

v0.26.1arrow_drop_down
v0.26.1
STATUS
Passing
DOWNLOADS
585
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
A year ago
SIZE
1 KB
Returns the first `n` elements of the given list, string, or
1 contributor
Install take as a package?
Copied
npm i @bit/ramda.ramda.take
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
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
//=> 'ram'
const personnel = [
  "Dave Brubeck",
  "Paul Desmond",
  "Eugene Wright",
  "Joe Morello",
  "Gerry Mulligan",
  "Bob Bates",
  "Joe Dodge",
  "Ron Crotty",
];
const takeFive = take(5);
  "foo",
  "bar",
  "baz",
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
*