omitPropconstant
omitProp: <T, K extends Key<T>>(input: T, key: K) => Omit<T, K>
| Return | |
|---|---|
unknown | A new object without the removed prop, or the original object if the key was not present. |
Remove a prop from an object (immutably) and return a new object without that prop.
- If the key doesn't exist the original object is returned unchanged.
Examples
omitProp({ a: 1, b: 2 }, "b"); // { a: 1 }