UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

14 lines (11 loc) 342 B
import { _isArray } from './_internals/_isArray' import { mapArray } from './map' export function props(propsToPick, obj){ if (arguments.length === 1){ return _obj => props(propsToPick, _obj) } if (!_isArray(propsToPick)){ throw new Error('propsToPick is not a list') } return mapArray(prop => obj[ prop ], propsToPick) }