Skip to main content
Module

x/rambda/omit.js

Faster and smaller alternative to Ramda
Go to Latest
File
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}