79f597cc90
category variant
12 lines
541 B
TypeScript
12 lines
541 B
TypeScript
export function omit<T extends Record<string, never>, K extends keyof never>(obj: T, keys: K[]): Omit<T, K> {
|
|
// I'm sure this could be done in a better way,
|
|
// but if we don't do this we run into issues with
|
|
// the interaction between Object.entries() and
|
|
// Set<string | number | symbol>.
|
|
const omitKeys = new Set(keys as string[]);
|
|
|
|
return Object.fromEntries(Object.entries(obj).filter(([k]) => !omitKeys.has(k))) as Omit<T, K>;
|
|
}
|
|
|
|
export const priceNumberFormat = (price: number) => Intl.NumberFormat("fa-IR").format(price);
|