This commit is contained in:
mahyargdz
2025-09-14 15:15:03 +03:30
commit be82059172
534 changed files with 51310 additions and 0 deletions
+29
View File
@@ -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);