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

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { find } from './find.js'import { propEq } from './propEq.js'
const list = [ { a : 1 }, { a : 2 }, { a : 3 } ]
test('happy', () => { const fn = propEq(2, 'a') expect(find(fn, list)).toEqual({ a : 2 })})
test('with curry', () => { const fn = propEq(4, 'a') expect(find(fn)(list)).toBeUndefined()})
test('with empty list', () => { expect(find(() => true, [])).toBeUndefined()})
rambda

Version Info

Tagged at
2 months ago