Object.omit

Object.omit

Object.omit

Function

Exclude fields by keyname and return a new object.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
keysArray/StringNo[]Array of keys to exclude, or multiple key parameters.

Return value

TypeDescription
ObjectReturns a new object excluding the specified key.

Return object fields

The returned object contains the fields in the original object that were not excluded. The excluded field does not exist, and the read result is empty; other field values come from the original object.

Example

Notes

  • omit does not modify the original object.
  • The returned object maintains the insertion order of the original object.