xdash API Reference / omit
Function: omit()
omit<
T
,K
>(obj
,keys
):Omit
<T
,K
>
Defined in: src/object.ts:72
Omit properties from an object.
Type Parameters
T
T
extends object
K
K
extends string
| number
| symbol
Parameters
obj
T
object to omit properties from
keys
K
[]
keys to omit
Returns
Omit
<T
, K
>
the object with the omitted properties
Example
ts
omit({ a: 1, b: 2 }, ['a']) // returns { b: 2 }
omit({ a: 'hello', b: 'world' }, ['a']) // returns { b: 'world' }
omit({ a: 1, b: 2 }, ['a', 'b']) // returns {}
omit({ a: 1, b: 2 }, []) // returns { a: 1, b: 2 }