deno.land / x / rambda@v9.1.1 / source / on.spec.js
12345678910111213141516171819202122232425262728293031323334353637import { on } from './on.js'
const binaryFn = (a, b) => a === bconst unaryFn = x => x.aconst a = { b : 0, a : 1,}const b = { a : 1 }
test('happy', () => { expect(on( binaryFn, unaryFn, a, b )).toBeTrue()})
test('return type is not limited to boolean', () => { expect(on( binaryFn, unaryFn, a, b )).toBeTrue()})
test('curried - last input', () => { expect(on( binaryFn, unaryFn, a )(b)).toBeTrue()})
test('curried - last two inputs', () => { expect(on(binaryFn, unaryFn)(a, b)).toBeTrue()})
test('not supported curried case', () => { expect(() => on(binaryFn, unaryFn)(a)(b)).toThrowErrorMatchingInlineSnapshot('"Cannot read properties of undefined (reading \'a\')"')})
Version Info