Skip to main content
Module

x/rambda/source/find.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import {find} from './find'import {propEq} from './propEq'
const list = [{a: 1}, {a: 2}, {a: 3}]
test('happy', () => { const fn = propEq('a', 2) expect(find(fn, list)).toEqual({a: 2})})
test('with curry', () => { const fn = propEq('a', 4) expect(find(fn)(list)).toBeUndefined()})
test('with empty list', () => { expect(find(() => true, [])).toBeUndefined()})