GoonCord/src/lib/utils/without.ts
2024-02-28 14:09:42 +08:00

5 lines
No EOL
226 B
TypeScript

export function without<O extends object, K extends readonly (keyof O)[]>(object: O, ...keys: K): Omit<O, typeof keys[number]> {
const cloned = { ...object };
keys.forEach((k) => delete cloned[k]);
return cloned;
}