import { selectIt } from './functional' test('object member selection', () => { const data = {one: { number: 1 }, two: 2, three: [1,2,{ mixed: true}] }; expect(selectIt('two', data)).toBe(2) expect(selectIt('one.number', data)).toBe(1) expect(selectIt('three.2.mixed', data)).toBeTruthy(); }); test('array member selection', () => { const arr = { array: [1,2,3,{ok: true}] } expect(selectIt('array.3.ok', arr)).toBeTruthy(); });