UNPKG

rambdax

Version:

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

21 lines (15 loc) 444 B
export function omit(propsToOmit, obj){ if (arguments.length === 1) return _obj => omit(propsToOmit, _obj) if (obj === null || obj === undefined){ return undefined } const propsToOmitValue = typeof propsToOmit === 'string' ? propsToOmit.split(',') : propsToOmit const willReturn = {} for (const key in obj){ if (!propsToOmitValue.includes(key)){ willReturn[ key ] = obj[ key ] } } return willReturn }