tools-min-ns 1.14.2 → 1.14.3

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,9 @@ cnpm i tools-min-ns --save
5
5
  ```
6
6
 
7
7
  # updates
8
+
9
+ ## v1.14.2
10
+ > StringUtil getUuiD 重构随机ID效率更高
8
11
  ## v1.14.2
9
12
  > DateUtil 日期格式化兼容优化
10
13
  ## v1.14.1
@@ -540,7 +540,12 @@ var StringUtil;
540
540
  if (randomLength === void 0) {
541
541
  randomLength = 9;
542
542
  }
543
- return Number(Math.random().toString().slice(2, randomLength + 2) + Date.now()).toString(36).slice(2, randomLength + 2);
543
+ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
544
+ var result = '';
545
+ for (var i = 0; i < randomLength; i++) {
546
+ result += chars[Math.floor(Math.random() * 62)]; // 生成一个随机字符,然后添加到结果字符串中
547
+ }
548
+ return result;
544
549
  }
545
550
  StringUtil.getUuiD = getUuiD;
546
551
  /** 默认颜色数组 */
@@ -550,7 +550,12 @@ var StringUtil;
550
550
  if (randomLength === void 0) {
551
551
  randomLength = 9;
552
552
  }
553
- return Number(Math.random().toString().slice(2, randomLength + 2) + Date.now()).toString(36).slice(2, randomLength + 2);
553
+ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
554
+ var result = '';
555
+ for (var i = 0; i < randomLength; i++) {
556
+ result += chars[Math.floor(Math.random() * 62)]; // 生成一个随机字符,然后添加到结果字符串中
557
+ }
558
+ return result;
554
559
  }
555
560
  StringUtil.getUuiD = getUuiD;
556
561
  /** 默认颜色数组 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tools-min-ns",
3
3
  "description": "工具包适用于前端以及node",
4
- "version": "1.14.2",
4
+ "version": "1.14.3",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
7
7
  "author": "nanshen",