Skip to main content
Module

x/rambda/nth.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { nth } from './nth'
test('happy', () => { expect(nth(2, [ 1, 2, 3, 4 ])).toEqual(3)})
test('with curry', () => { expect(nth(2)([ 1, 2, 3, 4 ])).toEqual(3)})
test('with string', () => { expect(nth(2)('foo')).toEqual('o')})
test('with negative index', () => { expect(nth(-3)([ 1, 2, 3, 4 ])).toEqual(2)})