nth

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
10
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
852 B
Returns the nth element of the given list or string.
1 contributor
Install nth as a package?
Copied
npm i @bit/justin-capalbo.ramda.nth
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
nth (
offset:Number,
list:*
) : *

Returns the nth element of the given list or string. If n is negative the element at index length + n is returned.

Example
const list = ['foo', 'bar', 'baz', 'quux'];
     R.nth(1, list); //=> 'bar'
     R.nth(-1, list); //=> 'quux'
     R.nth(-99, list); //=> undefined

     R.nth(2, 'abc'); //=> 'c'
     R.nth(3, 'abc'); //=> ''
Arguments
offset: Number
list: *
Returns
*

Help and resources