tools-min-ns 1.9.8 → 1.9.10

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/README.md CHANGED
@@ -5,6 +5,14 @@ cnpm i tools-min-ns --save
5
5
  ```
6
6
 
7
7
  # updates
8
+ ## v1.9.10
9
+
10
+ > NumberUtil correctNumberInput错误bug修复
11
+
12
+ ## v1.9.9
13
+
14
+ > DateUtil getDatesOfMonth日期错误bug修复
15
+
8
16
  ## v1.9.8
9
17
 
10
18
  > PasswordUtil aes加解密使用URL编码和解码
@@ -65,7 +65,7 @@ declare namespace Me {
65
65
  function invertedColors(): boolean | undefined;
66
66
  function forcedColors(): boolean | undefined;
67
67
  function monochrome(): number | undefined;
68
- function contrast(): 0 | 1 | 10 | -1 | undefined;
68
+ function contrast(): 0 | 10 | 1 | -1 | undefined;
69
69
  function reducedMotion(): boolean | undefined;
70
70
  function reducedTransparency(): boolean | undefined;
71
71
  function hdr(): boolean | undefined;
@@ -743,7 +743,7 @@ var DateUtil;
743
743
  // 将日期格式化为字符串并添加到数组中
744
744
  dates.push(DateUtil.formatDate(date, format));
745
745
  // 日期加一天
746
- date.setDate(date.getDate() + 2);
746
+ date.setDate(date.getDate() + 1);
747
747
  }
748
748
  return dates;
749
749
  }
@@ -137,12 +137,9 @@ var NumberUtil;
137
137
  if (n === void 0) {
138
138
  n = 2;
139
139
  }
140
- if (undefined == val || null == val || '' == val || isNaN(val)) {
141
- return 0;
142
- }
143
- var lastChar = val[val.length - 1] === '.' ? '.' : '';
144
- var str = (isNaN(parseFloat(val)) ? '' : parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n)) + lastChar;
145
- return Number(str);
140
+ if (!NumberUtil.isaFinite(Number(val))) return 0;
141
+ var num = parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n);
142
+ return NumberUtil.isaFinite(num) ? num : 0;
146
143
  }
147
144
  NumberUtil.correctNumberInput = correctNumberInput;
148
145
  /**
@@ -65,7 +65,7 @@ declare namespace Me {
65
65
  function invertedColors(): boolean | undefined;
66
66
  function forcedColors(): boolean | undefined;
67
67
  function monochrome(): number | undefined;
68
- function contrast(): 0 | 1 | 10 | -1 | undefined;
68
+ function contrast(): 0 | 10 | 1 | -1 | undefined;
69
69
  function reducedMotion(): boolean | undefined;
70
70
  function reducedTransparency(): boolean | undefined;
71
71
  function hdr(): boolean | undefined;
@@ -753,7 +753,7 @@ var DateUtil;
753
753
  // 将日期格式化为字符串并添加到数组中
754
754
  dates.push(DateUtil.formatDate(date, format));
755
755
  // 日期加一天
756
- date.setDate(date.getDate() + 2);
756
+ date.setDate(date.getDate() + 1);
757
757
  }
758
758
  return dates;
759
759
  }
@@ -147,12 +147,9 @@ var NumberUtil;
147
147
  if (n === void 0) {
148
148
  n = 2;
149
149
  }
150
- if (undefined == val || null == val || '' == val || isNaN(val)) {
151
- return 0;
152
- }
153
- var lastChar = val[val.length - 1] === '.' ? '.' : '';
154
- var str = (isNaN(parseFloat(val)) ? '' : parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n)) + lastChar;
155
- return Number(str);
150
+ if (!NumberUtil.isaFinite(Number(val))) return 0;
151
+ var num = parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n);
152
+ return NumberUtil.isaFinite(num) ? num : 0;
156
153
  }
157
154
  NumberUtil.correctNumberInput = correctNumberInput;
158
155
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tools-min-ns",
3
3
  "description": "工具包适用于前端以及node",
4
- "version": "1.9.8",
4
+ "version": "1.9.10",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
7
7
  "author": "nanshen",