Przeglądaj źródła

chore(utils): 添加判断空值的函数

wangcong 2 tygodni temu
rodzic
commit
336d708acc
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      src/utils/index.ts

+ 4 - 0
src/utils/index.ts

@@ -265,6 +265,10 @@ export const calcPercentage = (currentValue?: number, maxValue?: number) => {
   return Number(percentage.toFixed(2));
 };
 
+export const isEmptyVal = (value: unknown) => {
+  return value === undefined || value === null;
+};
+
 export const isNotEmptyVal = (value: unknown) => {
   return value !== undefined && value !== null;
 };