first
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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);
|
||||
|
||||
// const omitKey = [
|
||||
// "learningStatus",
|
||||
// "contractStatus",
|
||||
// "registerStatus",
|
||||
// "documentStatus",
|
||||
// "paymentStatus",
|
||||
// "rate",
|
||||
// "prodcuts",
|
||||
// "purchases",
|
||||
// "orders",
|
||||
// ];
|
||||
// const payload = omit(updateDto, omitKey);
|
||||
// console.log(payload);
|
||||
|
||||
// const omitKey = ["basket", "favoriteProducts", "comments", "orders", "phoneNumber", "email"];
|
||||
// const payload = omit(updateDto, omitKey);
|
||||
// console.log(payload);
|
||||
Reference in New Issue
Block a user