omitProps()function
omitProps(input: T, ...keys: K[]): Omit<T, K>
| Param | Type | |
|---|---|---|
input | T | The object to remove the props from. required |
keys | K[] | The keys of the props to remove. required |
| Return | |
|---|---|
Omit<T, K> | A new object without the removed props, or the original object if no keys were present. |
Remove several props from an object (immutably) and return a new object without those props.
- If none of the keys exist the original object is returned unchanged.
Examples
omitProps({ a: 1, b: 2, c: 3 }, "b", "c"); // { a: 1 }