deno.land / x / rambda@v9.1.1 / source / nth.spec.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { nth } from './nth.js'
test('happy', () => { expect(nth(2, [ 1, 2, 3, 4 ])).toBe(3)})
test('with curry', () => { expect(nth(2)([ 1, 2, 3, 4 ])).toBe(3)})
test('with string and correct index', () => { expect(nth(2)('foo')).toBe('o')})
test('with string and invalid index', () => { expect(nth(20)('foo')).toBe('')})
test('with negative index', () => { expect(nth(-3)([ 1, 2, 3, 4 ])).toBe(2)})
rambda

Version Info

Tagged at
2 months ago