mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 22:52:36 +03:00
17 lines
356 B
TypeScript
17 lines
356 B
TypeScript
const removeFieldsFromObject = <
|
|
T extends Record<string, unknown>,
|
|
K extends keyof T
|
|
>(
|
|
obj: T,
|
|
fields: K[]
|
|
): Omit<T, K> => {
|
|
const result = { ...obj };
|
|
for (const field of fields) {
|
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
delete result[field];
|
|
}
|
|
return result;
|
|
};
|
|
|
|
export default removeFieldsFromObject;
|