iv-npm 1.6.99 → 1.6.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iv-npm",
3
- "version": "1.6.99",
3
+ "version": "1.6.100",
4
4
  "description": "公共通用包",
5
5
  "author": "Mr.Cong",
6
6
  "license": "ISC",
@@ -44,7 +44,14 @@ declare const arraySumByKey: (arr: any[], key: string) => any;
44
44
  * @param {object[]} object2[]
45
45
  * @return {Number}
46
46
  */
47
- declare const isArraySumCompared: (arr1: any[], arr2: any[], key1: string, key2?: string) => boolean;
47
+ declare const isArraySumCompared: (arr1: any[], arr2: any[], key1: string, key2?: string) => boolean;
48
+ /**
49
+ * @description 格式化数字,增加千分位标记和保留小数
50
+ * @param {Number} num
51
+ * @param {Number} suffix 默认保留两位小数
52
+ * @return {String}
53
+ */
54
+ declare const numFormat: (num: number, suffix?: number) => string;
48
55
 
49
56
  /**
50
57
  * 检查对象是否为普通对象(使用“{}”或“new Object”创建)
@@ -128,4 +135,4 @@ declare function getAmountByUnit(amount: number): string;
128
135
  * */
129
136
  declare const amountToFixed: (_v?: number | string) => string | 0;
130
137
 
131
- export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, arraySum, arraySumByKey, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatPercentage, formatType, getAmountByUnit, hostConfiger, isArraySumCompared, isDate, isObject, isPlainObject, isURLSearchParams, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
138
+ export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, arraySum, arraySumByKey, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatPercentage, formatType, getAmountByUnit, hostConfiger, isArraySumCompared, isDate, isObject, isPlainObject, isURLSearchParams, numFormat, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
@@ -86,6 +86,12 @@ var isArraySumCompared = (arr1, arr2, key1, key2) => {
86
86
  const k2 = key2 ?? key1;
87
87
  return arraySumByKey(arr1, k1) === arraySumByKey(arr2, k2);
88
88
  };
89
+ var numFormat = (num, suffix = 2) => {
90
+ const value = Number(num);
91
+ if (Number.isNaN(value))
92
+ return "0.00";
93
+ return value.toLocaleString("en-US", { minimumFractionDigits: suffix });
94
+ };
89
95
 
90
96
  // utils/obj/judge.ts
91
97
  function isPlainObject(obj) {
@@ -475,6 +481,7 @@ export {
475
481
  isPlainObject,
476
482
  isURLSearchParams,
477
483
  minus,
484
+ numFormat,
478
485
  onChangeTail,
479
486
  plus,
480
487
  round,