UNPKG

moy-fp

Version:
24 lines (20 loc) 450 B
import __ from '../../src/Function/__' /** * k -> {k: v} -> v | undefined */ import prop from '../../src/Object/prop' test('prop(not using __), exist key', () => { expect( prop('a')({a: 1, b: 2, c: 3}) ).toBe(1) }) test('prop(not using __), not exist key', () => { expect( prop('d')({a: 1, b: 2, c: 3}) ).toBeUndefined() }) test('prop(using __), exist key', () => { expect( prop(__, {a: 1, b: 2, c: 3})('a') ).toBe(1) })