mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-12 11:55:26 +08:00
11 lines
335 B
TypeScript
11 lines
335 B
TypeScript
|
function omit<T extends object, K extends keyof T>(obj: T, fields: K[]): Omit<T, K> {
|
||
|
// eslint-disable-next-line prefer-object-spread
|
||
|
const shallowCopy = Object.assign({}, obj);
|
||
|
for (let i = 0; i < fields.length; i += 1) {
|
||
|
const key = fields[i];
|
||
|
delete shallowCopy[key];
|
||
|
}
|
||
|
return shallowCopy;
|
||
|
}
|
||
|
export default omit;
|