Skip to main content
Module

x/rambda/findIndex.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { findIndex } from './findIndex'import { propEq } from './propEq'
const list = [ { a : 1 }, { a : 2 }, { a : 3 } ]
test('happy', () => { expect(findIndex(propEq('a', 2), list)).toEqual(1)
expect(findIndex(propEq('a', 1))(list)).toEqual(0)
expect(findIndex(propEq('a', 4))(list)).toEqual(-1)})