@syzlm/function 1.0.0 → 1.0.2

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.
Files changed (108) hide show
  1. package/dist/arrays/arrayUtils.d.ts +13 -1
  2. package/dist/arrays/arrayUtils.d.ts.map +1 -1
  3. package/dist/business/index.d.ts +2 -0
  4. package/dist/business/index.d.ts.map +1 -0
  5. package/dist/business/parseQrcode.d.ts +34 -0
  6. package/dist/business/parseQrcode.d.ts.map +1 -0
  7. package/dist/index.cjs.js +1 -1
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/objects/objectUtils.d.ts +7 -0
  14. package/dist/objects/objectUtils.d.ts.map +1 -1
  15. package/dist/storage/index.d.ts +2 -0
  16. package/dist/storage/index.d.ts.map +1 -0
  17. package/dist/storage/storage.d.ts +13 -0
  18. package/dist/storage/storage.d.ts.map +1 -0
  19. package/dist/strings/stringUtils.d.ts.map +1 -1
  20. package/docs/README.md +33 -0
  21. package/docs/functions/capitalize.md +27 -0
  22. package/docs/functions/chunk.md +39 -0
  23. package/docs/functions/clamp.md +39 -0
  24. package/docs/functions/debounce.md +49 -0
  25. package/docs/functions/deepClone.md +33 -0
  26. package/docs/functions/delay.md +27 -0
  27. package/docs/functions/get.md +39 -0
  28. package/docs/functions/getFontLength.md +27 -0
  29. package/docs/functions/getFontWidth.md +33 -0
  30. package/docs/functions/isPlainObject.md +27 -0
  31. package/docs/functions/merge.md +39 -0
  32. package/docs/functions/parseQrcode.md +63 -0
  33. package/docs/functions/parseStrEmpty.md +27 -0
  34. package/docs/functions/randomString.md +27 -0
  35. package/docs/functions/range.md +39 -0
  36. package/docs/functions/round.md +33 -0
  37. package/docs/functions/set.md +45 -0
  38. package/docs/functions/shuffle.md +33 -0
  39. package/docs/functions/simpleUnique.md +40 -0
  40. package/docs/functions/thousandSign.md +27 -0
  41. package/docs/functions/thousandSignZero.md +33 -0
  42. package/docs/functions/throttle.md +49 -0
  43. package/docs/functions/toCamelCase.md +27 -0
  44. package/docs/functions/toFixed.md +33 -0
  45. package/docs/functions/unique.md +39 -0
  46. package/package.json +22 -4
  47. package/src/arrays/arrayUtils.ts +33 -3
  48. package/src/arrays/index.ts +1 -1
  49. package/src/business/index.ts +2 -0
  50. package/src/business/parseQrcode.ts +81 -0
  51. package/src/index.ts +4 -1
  52. package/src/numbers/index.ts +1 -1
  53. package/src/numbers/numberUtils.ts +7 -7
  54. package/src/objects/index.ts +1 -1
  55. package/src/objects/objectUtils.ts +18 -13
  56. package/src/storage/storage.ts +5 -4
  57. package/src/strings/index.ts +1 -1
  58. package/src/strings/stringUtils.ts +11 -9
  59. package/src/utils/index.ts +1 -1
  60. package/src/utils/utilFunctions.ts +3 -3
  61. package/README.md +0 -111
  62. package/docs/.nojekyll +0 -1
  63. package/docs/assets/hierarchy.js +0 -1
  64. package/docs/assets/highlight.css +0 -85
  65. package/docs/assets/icons.js +0 -18
  66. package/docs/assets/icons.svg +0 -1
  67. package/docs/assets/main.js +0 -60
  68. package/docs/assets/navigation.js +0 -1
  69. package/docs/assets/search.js +0 -1
  70. package/docs/assets/style.css +0 -1633
  71. package/docs/functions/capitalize.html +0 -4
  72. package/docs/functions/chunk.html +0 -5
  73. package/docs/functions/clamp.html +0 -6
  74. package/docs/functions/debounce.html +0 -5
  75. package/docs/functions/deepClone.html +0 -4
  76. package/docs/functions/delay.html +0 -4
  77. package/docs/functions/get.html +0 -6
  78. package/docs/functions/getFontLength.html +0 -4
  79. package/docs/functions/getFontWidth.html +0 -5
  80. package/docs/functions/isPlainObject.html +0 -4
  81. package/docs/functions/merge.html +0 -5
  82. package/docs/functions/parseStrEmpty.html +0 -4
  83. package/docs/functions/randomString.html +0 -4
  84. package/docs/functions/range.html +0 -6
  85. package/docs/functions/round.html +0 -5
  86. package/docs/functions/set.html +0 -6
  87. package/docs/functions/shuffle.html +0 -4
  88. package/docs/functions/thousandSign.html +0 -4
  89. package/docs/functions/thousandSignZero.html +0 -5
  90. package/docs/functions/throttle.html +0 -5
  91. package/docs/functions/toCamelCase.html +0 -4
  92. package/docs/functions/toFixed.html +0 -5
  93. package/docs/functions/unique.html +0 -4
  94. package/docs/hierarchy.html +0 -1
  95. package/docs/index.html +0 -53
  96. package/docs/modules.html +0 -1
  97. package/jest.config.js +0 -8
  98. package/rollup.config.js +0 -29
  99. package/scripts/deploy-docs.sh +0 -40
  100. package/test-output.txt +0 -23
  101. package/test-tofixed.js +0 -36
  102. package/tests/arrays.test.ts +0 -89
  103. package/tests/numbers.test.ts +0 -140
  104. package/tests/objects.test.ts +0 -189
  105. package/tests/strings.test.ts +0 -197
  106. package/tests/utils.test.ts +0 -121
  107. package/tsconfig.json +0 -21
  108. package/typedoc.json +0 -15
@@ -0,0 +1,27 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / isPlainObject
6
+
7
+ # Function: isPlainObject()
8
+
9
+ > **isPlainObject**(`value`): `value is object`
10
+
11
+ Defined in: objects/objectUtils.ts:95
12
+
13
+ 检查一个值是否是普通对象
14
+
15
+ ## Parameters
16
+
17
+ ### value
18
+
19
+ `any`
20
+
21
+ 要检查的值
22
+
23
+ ## Returns
24
+
25
+ `value is object`
26
+
27
+ 如果是普通对象返回true,否则返回false
@@ -0,0 +1,39 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / merge
6
+
7
+ # Function: merge()
8
+
9
+ > **merge**\<`T`\>(`target`, ...`sources`): `T`
10
+
11
+ Defined in: objects/objectUtils.ts:38
12
+
13
+ 对象合并函数
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T` *extends* `object`
20
+
21
+ ## Parameters
22
+
23
+ ### target
24
+
25
+ `T`
26
+
27
+ 目标对象
28
+
29
+ ### sources
30
+
31
+ ...`any`[]
32
+
33
+ 源对象列表
34
+
35
+ ## Returns
36
+
37
+ `T`
38
+
39
+ 合并后的对象
@@ -0,0 +1,63 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / parseQrcode
6
+
7
+ # Function: parseQrcode()
8
+
9
+ > **parseQrcode**(`str`): \{ `invoiceCode`: `string`; `invoiceNumber`: `string`; `invoiceDate`: `string`; `optionField`: `string`; `taxFreeAmount`: `string`; \} \| `null`
10
+
11
+ Defined in: business/parseQrcode.ts:22
12
+
13
+ ## Parameters
14
+
15
+ ### str
16
+
17
+ `string`
18
+
19
+ 二维码字符串
20
+
21
+ ## Returns
22
+
23
+ \{ `invoiceCode`: `string`; `invoiceNumber`: `string`; `invoiceDate`: `string`; `optionField`: `string`; `taxFreeAmount`: `string`; \}
24
+
25
+ ### invoiceCode
26
+
27
+ > **invoiceCode**: `string`
28
+
29
+ 发票代码
30
+
31
+ ### invoiceNumber
32
+
33
+ > **invoiceNumber**: `string`
34
+
35
+ 发票号码
36
+
37
+ ### invoiceDate
38
+
39
+ > **invoiceDate**: `string`
40
+
41
+ 开票日期
42
+
43
+ ### optionField
44
+
45
+ > **optionField**: `string`
46
+
47
+ 校验码
48
+
49
+ ### taxFreeAmount
50
+
51
+ > **taxFreeAmount**: `string`
52
+
53
+ 不含税金额
54
+
55
+ `null`
56
+
57
+ 解析后的 发票代码、发票号码、开票日期、校验码、不含税金额
58
+
59
+ ## Description
60
+
61
+ 税局生成的PDF/OFD版式文件中,左上角二维码扫描之后是一串有规则数字,现整理规则如下:
62
+
63
+ ## Example
@@ -0,0 +1,27 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / parseStrEmpty
6
+
7
+ # Function: parseStrEmpty()
8
+
9
+ > **parseStrEmpty**(`str`): `string`
10
+
11
+ Defined in: strings/stringUtils.ts:42
12
+
13
+ 转换字符串,undefined,null等转化为""
14
+
15
+ ## Parameters
16
+
17
+ ### str
18
+
19
+ `string`
20
+
21
+ 需要转换的字符串
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ 转换后的字符串
@@ -0,0 +1,27 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / randomString
6
+
7
+ # Function: randomString()
8
+
9
+ > **randomString**(`length`): `string`
10
+
11
+ Defined in: strings/stringUtils.ts:27
12
+
13
+ 生成随机字符串函数
14
+
15
+ ## Parameters
16
+
17
+ ### length
18
+
19
+ `number`
20
+
21
+ 字符串长度
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ 随机字符串
@@ -0,0 +1,39 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / range
6
+
7
+ # Function: range()
8
+
9
+ > **range**(`start`, `end`, `step`): `number`[]
10
+
11
+ Defined in: numbers/numberUtils.ts:8
12
+
13
+ 数字范围生成函数
14
+
15
+ ## Parameters
16
+
17
+ ### start
18
+
19
+ `number`
20
+
21
+ 起始数字
22
+
23
+ ### end
24
+
25
+ `number`
26
+
27
+ 结束数字
28
+
29
+ ### step
30
+
31
+ `number` = `1`
32
+
33
+ 步长
34
+
35
+ ## Returns
36
+
37
+ `number`[]
38
+
39
+ 生成的数字数组
@@ -0,0 +1,33 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / round
6
+
7
+ # Function: round()
8
+
9
+ > **round**(`num`, `decimals`): `number`
10
+
11
+ Defined in: numbers/numberUtils.ts:22
12
+
13
+ 数字四舍五入函数
14
+
15
+ ## Parameters
16
+
17
+ ### num
18
+
19
+ `number`
20
+
21
+ 需要四舍五入的数字
22
+
23
+ ### decimals
24
+
25
+ `number` = `0`
26
+
27
+ 保留小数位数
28
+
29
+ ## Returns
30
+
31
+ `number`
32
+
33
+ 四舍五入后的数字
@@ -0,0 +1,45 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / set
6
+
7
+ # Function: set()
8
+
9
+ > **set**\<`T`\>(`obj`, `path`, `value`): `T`
10
+
11
+ Defined in: objects/objectUtils.ts:70
12
+
13
+ 设置对象属性值(支持路径访问)
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T` *extends* `Record`\<`string`, `any`\>
20
+
21
+ ## Parameters
22
+
23
+ ### obj
24
+
25
+ `T`
26
+
27
+ 目标对象
28
+
29
+ ### path
30
+
31
+ `string`
32
+
33
+ 属性路径,如 'a.b.c'
34
+
35
+ ### value
36
+
37
+ `any`
38
+
39
+ 要设置的值
40
+
41
+ ## Returns
42
+
43
+ `T`
44
+
45
+ 设置后的对象
@@ -0,0 +1,33 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / shuffle
6
+
7
+ # Function: shuffle()
8
+
9
+ > **shuffle**\<`T`\>(`arr`): `T`[]
10
+
11
+ Defined in: arrays/arrayUtils.ts:45
12
+
13
+ 数组随机打乱函数
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T`
20
+
21
+ ## Parameters
22
+
23
+ ### arr
24
+
25
+ `T`[]
26
+
27
+ 需要打乱的数组
28
+
29
+ ## Returns
30
+
31
+ `T`[]
32
+
33
+ 打乱后的新数组
@@ -0,0 +1,40 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / simpleUnique
6
+
7
+ # Function: simpleUnique()
8
+
9
+ > **simpleUnique**\<`T`\>(`arr`): `T`[]
10
+
11
+ Defined in: arrays/arrayUtils.ts:11
12
+
13
+ 简单数组去重函数
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T`
20
+
21
+ ## Parameters
22
+
23
+ ### arr
24
+
25
+ `T`[]
26
+
27
+ 需要去重的数组
28
+
29
+ ## Returns
30
+
31
+ `T`[]
32
+
33
+ 去重后的新数组
34
+
35
+ ## Example
36
+
37
+ ``` javascript
38
+ import {simpleUnique} from '@syzlm/function/arrays';
39
+ console.log(simpleUnique([1,3,4,56,1,3]))
40
+ ```
@@ -0,0 +1,27 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / thousandSign
6
+
7
+ # Function: thousandSign()
8
+
9
+ > **thousandSign**(`num`): `string`
10
+
11
+ Defined in: strings/stringUtils.ts:90
12
+
13
+ 千分位格式化
14
+
15
+ ## Parameters
16
+
17
+ ### num
18
+
19
+ 需要格式化的数字或字符串
20
+
21
+ `string` | `number`
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ 千分位格式化后的字符串
@@ -0,0 +1,33 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / thousandSignZero
6
+
7
+ # Function: thousandSignZero()
8
+
9
+ > **thousandSignZero**(`num`, `fixed?`): `string`
10
+
11
+ Defined in: strings/stringUtils.ts:110
12
+
13
+ 千分位格式化 自动补零
14
+
15
+ ## Parameters
16
+
17
+ ### num
18
+
19
+ 需要格式化的数字或字符串
20
+
21
+ `string` | `number`
22
+
23
+ ### fixed?
24
+
25
+ `number`
26
+
27
+ 保留的小数位数,默认2位
28
+
29
+ ## Returns
30
+
31
+ `string`
32
+
33
+ 千分位格式化后的字符串
@@ -0,0 +1,49 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / throttle
6
+
7
+ # Function: throttle()
8
+
9
+ > **throttle**\<`T`\>(`func`, `limit`): (...`args`) => `void`
10
+
11
+ Defined in: utils/utilFunctions.ts:24
12
+
13
+ 节流函数
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T` *extends* (...`args`) => `any`
20
+
21
+ ## Parameters
22
+
23
+ ### func
24
+
25
+ `T`
26
+
27
+ 需要节流的函数
28
+
29
+ ### limit
30
+
31
+ `number`
32
+
33
+ 限制时间(毫秒)
34
+
35
+ ## Returns
36
+
37
+ 节流后的函数
38
+
39
+ > (...`args`): `void`
40
+
41
+ ### Parameters
42
+
43
+ #### args
44
+
45
+ ...`Parameters`\<`T`\>
46
+
47
+ ### Returns
48
+
49
+ `void`
@@ -0,0 +1,27 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / toCamelCase
6
+
7
+ # Function: toCamelCase()
8
+
9
+ > **toCamelCase**(`str`): `string`
10
+
11
+ Defined in: strings/stringUtils.ts:8
12
+
13
+ 字符串驼峰命名转换函数
14
+
15
+ ## Parameters
16
+
17
+ ### str
18
+
19
+ `string`
20
+
21
+ 需要转换的字符串
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ 驼峰命名的字符串
@@ -0,0 +1,33 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / toFixed
6
+
7
+ # Function: toFixed()
8
+
9
+ > **toFixed**(`num`, `digits`): `string`
10
+
11
+ Defined in: numbers/numberUtils.ts:44
12
+
13
+ 精确的数字toFixed函数
14
+
15
+ ## Parameters
16
+
17
+ ### num
18
+
19
+ `number`
20
+
21
+ 需要处理的数字
22
+
23
+ ### digits
24
+
25
+ `number` = `0`
26
+
27
+ 保留小数位数
28
+
29
+ ## Returns
30
+
31
+ `string`
32
+
33
+ 格式化后的字符串
@@ -0,0 +1,39 @@
1
+ [**Function - TypeScript 工具函数库 v1.0.1**](../README.md)
2
+
3
+ ***
4
+
5
+ [Function - TypeScript 工具函数库](../README.md) / unique
6
+
7
+ # Function: unique()
8
+
9
+ > **unique**\<`T`\>(`arr`, `field?`): `T`[]
10
+
11
+ Defined in: arrays/arrayUtils.ts:21
12
+
13
+ 数组去重函数
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T` *extends* `Record`\<`string`, `any`\>
20
+
21
+ ## Parameters
22
+
23
+ ### arr
24
+
25
+ `T`[]
26
+
27
+ 需要去重的数组
28
+
29
+ ### field?
30
+
31
+ `string`
32
+
33
+ 对象数组去重需要传,对象数组去重对比字段
34
+
35
+ ## Returns
36
+
37
+ `T`[]
38
+
39
+ 去重后的新数组
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@syzlm/function",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "type": "module",
7
8
  "exports": {
8
9
  ".": {
9
10
  "import": "./dist/index.js",
@@ -11,14 +12,23 @@
11
12
  "types": "./dist/index.d.ts"
12
13
  }
13
14
  },
15
+ "files": [
16
+ "dist",
17
+ "docs",
18
+ "src"
19
+ ],
14
20
  "scripts": {
15
21
  "build": "rollup -c && tsc --emitDeclarationOnly",
16
22
  "watch": "rollup -c -w",
17
- "docs": "typedoc",
23
+ "docs": "typedoc ",
18
24
  "docs:serve": "typedoc && npx serve docs",
19
25
  "docs:update": "typedoc",
20
26
  "build:with-docs": "rollup -c && tsc --emitDeclarationOnly && typedoc",
21
- "test": "jest --verbose"
27
+ "test": "jest --verbose",
28
+ "lint": "eslint src/**/*.ts",
29
+ "lint:fix": "eslint src/**/*.ts --fix",
30
+ "format": "prettier --write src/**/*.ts",
31
+ "format:check": "prettier --check src/**/*.ts"
22
32
  },
23
33
  "keywords": [],
24
34
  "author": "",
@@ -31,13 +41,21 @@
31
41
  "@rollup/plugin-typescript": "^12.3.0",
32
42
  "@types/jest": "^30.0.0",
33
43
  "@types/node": "^24.10.1",
44
+ "@typescript-eslint/eslint-plugin": "^8.49.0",
45
+ "@typescript-eslint/parser": "^8.49.0",
46
+ "eslint": "^9.39.1",
47
+ "eslint-config-prettier": "^10.1.8",
48
+ "eslint-plugin-prettier": "^5.5.4",
34
49
  "jest": "^30.2.0",
50
+ "prettier": "^3.7.4",
35
51
  "rollup": "^2.79.2",
36
52
  "serve": "^14.2.5",
37
53
  "ts-jest": "^29.4.6",
38
54
  "ts-node": "^10.9.2",
39
55
  "tslib": "^2.8.1",
40
56
  "typedoc": "^0.28.15",
57
+ "typedoc-plugin-markdown": "^4.9.0",
41
58
  "typescript": "^5.9.3"
42
- }
59
+ },
60
+ "homepage": "https://gitee.com/unemployed-company/function/tree/master/docs"
43
61
  }
@@ -1,12 +1,42 @@
1
1
  /**
2
- * 数组去重函数
2
+ * 简单数组去重函数
3
3
  * @param arr 需要去重的数组
4
4
  * @returns 去重后的新数组
5
+ * @example
6
+ * ``` javascript
7
+ * import {simpleUnique} from '@syzlm/function/arrays';
8
+ * console.log(simpleUnique([1,3,4,56,1,3]))
9
+ * ```
5
10
  */
6
- export function unique<T>(arr: T[]): T[] {
11
+ export function simpleUnique<T>(arr: T[]): T[] {
7
12
  return [...new Set(arr)];
8
13
  }
9
14
 
15
+ /**
16
+ * 数组去重函数
17
+ * @param arr 需要去重的数组
18
+ * @param field 对象数组去重需要传,对象数组去重对比字段
19
+ * @returns 去重后的新数组
20
+ */
21
+ export function unique<T extends Record<string, any>>(
22
+ arr: T[],
23
+ field?: string
24
+ ): T[] {
25
+ if (field && arr?.length) {
26
+ const map = new Map();
27
+ return arr.reduce<T[]>((res, cur) => {
28
+ const uniqueKey = field ? cur[field] : JSON.stringify(cur);
29
+ if (!map.has(uniqueKey)) {
30
+ map.set(uniqueKey, true);
31
+ res.push(cur);
32
+ }
33
+ return res;
34
+ }, []);
35
+ } else {
36
+ return [...new Set(arr)];
37
+ }
38
+ }
39
+
10
40
  /**
11
41
  * 数组随机打乱函数
12
42
  * @param arr 需要打乱的数组
@@ -33,4 +63,4 @@ export function chunk<T>(arr: T[], size: number): T[][] {
33
63
  result.push(arr.slice(i, i + size));
34
64
  }
35
65
  return result;
36
- }
66
+ }
@@ -1,2 +1,2 @@
1
1
  // 数组工具函数目录入口
2
- export * from './arrayUtils';
2
+ export * from './arrayUtils';