GoonCord/src/lib/utils/without.ts

5 lines
226 B
TypeScript
Raw Normal View History

export function without<O extends object, K extends readonly (keyof O)[]>(object: O, ...keys: K): Omit<O, typeof keys[number]> {
2023-04-09 19:53:26 +01:00
const cloned = { ...object };
keys.forEach((k) => delete cloned[k]);
return cloned;
}