UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

16 lines (14 loc) 275 B
export function partitionObject(predicate) { return obj => { const yes = {} const no = {} Object.entries(obj).forEach(([prop, value]) => { if (predicate(value, prop)) { yes[prop] = value } else { no[prop] = value } }) return [yes, no] } }