util-helpers 4.17.2 → 4.17.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/dist/util-helpers.js +3 -1
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/utils/config.js +1 -1
- package/lib/utils/config.js +1 -1
- package/package.json +20 -22
- package/types/ajax.d.ts +1 -1
- package/types/blobToDataURL.d.ts +1 -1
- package/types/calculateCursorPosition.d.ts +1 -1
- package/types/download.d.ts +7 -3
- package/types/filterTree.d.ts +3 -1
- package/types/isIdCard.d.ts +3 -1
- package/types/numberToChinese.d.ts +1 -1
- package/types/setDataURLPrefix.d.ts +2 -1
- package/types/treeToList.d.ts +3 -6
- package/types/utils/type/isBlob.d.ts +1 -1
- package/types/utils/type/isError.d.ts +2 -2
- package/types/utils/type/isNil.d.ts +1 -1
package/esm/utils/config.js
CHANGED
package/lib/utils/config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "util-helpers",
|
|
3
|
-
"version": "4.17.
|
|
3
|
+
"version": "4.17.3",
|
|
4
4
|
"description": "一个基于业务场景的工具方法库",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -18,12 +18,11 @@
|
|
|
18
18
|
"build": "npm run build:module && npm run build:dist && npm run build:types",
|
|
19
19
|
"build:module": "rm -rf esm && rm -rf lib && rollup -c rollup.module.config.mjs",
|
|
20
20
|
"build:dist": "rm -rf dist && rollup -c rollup.umd.config.mjs",
|
|
21
|
-
"build:types": "rm -rf types && tsc -d --outDir types --emitDeclarationOnly",
|
|
21
|
+
"build:types": "rm -rf types && tsc -p tsconfig.build.json -d --outDir types --emitDeclarationOnly",
|
|
22
22
|
"build:doc": "npm run doc",
|
|
23
|
-
"doc": "rm -rf docs && rm -rf docs-src && tsc --outDir docs-src && jsdoc -c conf.json && rm -rf docs-src",
|
|
23
|
+
"doc": "rm -rf docs && rm -rf docs-src && tsc -p tsconfig.build.json --outDir docs-src && jsdoc -c conf.json && rm -rf docs-src",
|
|
24
24
|
"doc:open": "open ./docs/index.html",
|
|
25
25
|
"prettier": "prettier --write 'src/**/*.ts' && prettier --write 'test/**/*.ts'",
|
|
26
|
-
"precommit": "lint-staged",
|
|
27
26
|
"lint": "eslint src --ext .ts",
|
|
28
27
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
29
28
|
"commit": "cz",
|
|
@@ -55,42 +54,41 @@
|
|
|
55
54
|
},
|
|
56
55
|
"homepage": "https://doly-dev.github.io/util-helpers/index.html",
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@babel/core": "^7.21.
|
|
59
|
-
"@babel/preset-env": "^7.21.
|
|
60
|
-
"@babel/preset-typescript": "^7.21.
|
|
61
|
-
"@commitlint/cli": "^
|
|
62
|
-
"@commitlint/config-conventional": "^
|
|
57
|
+
"@babel/core": "^7.21.8",
|
|
58
|
+
"@babel/preset-env": "^7.21.5",
|
|
59
|
+
"@babel/preset-typescript": "^7.21.5",
|
|
60
|
+
"@commitlint/cli": "^17.6.3",
|
|
61
|
+
"@commitlint/config-conventional": "^17.6.3",
|
|
63
62
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
64
63
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
65
64
|
"@rollup/plugin-replace": "^5.0.2",
|
|
66
65
|
"@rollup/plugin-terser": "^0.4.1",
|
|
67
66
|
"@rollup/plugin-typescript": "^11.1.0",
|
|
68
67
|
"@types/jest": "^29.5.1",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
70
|
-
"@typescript-eslint/parser": "^5.59.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
69
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
71
70
|
"babel-jest": "^29.5.0",
|
|
72
71
|
"babel-plugin-minify-replace": "^0.5.0",
|
|
73
72
|
"cross-env": "^7.0.3",
|
|
74
73
|
"cz-conventional-changelog": "^3.3.0",
|
|
75
|
-
"docdash": "^
|
|
76
|
-
"eslint": "^8.
|
|
77
|
-
"husky": "^4.3.6",
|
|
74
|
+
"docdash": "^2.0.1",
|
|
75
|
+
"eslint": "^8.40.0",
|
|
78
76
|
"jest": "^29.5.0",
|
|
79
77
|
"jest-environment-jsdom": "^29.5.0",
|
|
80
|
-
"jsdoc": "^
|
|
81
|
-
"lint-staged": "^
|
|
78
|
+
"jsdoc": "^4.0.2",
|
|
79
|
+
"lint-staged": "^13.2.2",
|
|
82
80
|
"prettier": "^2.8.8",
|
|
83
|
-
"rollup": "^3.21.
|
|
84
|
-
"typescript": "^5.0.4"
|
|
81
|
+
"rollup": "^3.21.6",
|
|
82
|
+
"typescript": "^5.0.4",
|
|
83
|
+
"yorkie": "^2.0.0"
|
|
85
84
|
},
|
|
86
85
|
"lint-staged": {
|
|
87
86
|
"**/*.ts": "eslint",
|
|
88
87
|
"**/*.{js,ts,md}": "prettier --write"
|
|
89
88
|
},
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
}
|
|
89
|
+
"gitHooks": {
|
|
90
|
+
"pre-commit": "lint-staged",
|
|
91
|
+
"commit-msg": "npx --no -- commitlint --edit \"$1\""
|
|
94
92
|
},
|
|
95
93
|
"config": {
|
|
96
94
|
"commitizen": {
|
package/types/ajax.d.ts
CHANGED
package/types/blobToDataURL.d.ts
CHANGED
package/types/download.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ type DownloadOptions = {
|
|
|
29
29
|
* @property {TransformResponse} [options.transformResponse] 请求成功后触发,在传递给 then/catch 前,允许修改响应数据
|
|
30
30
|
*/
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* 下载
|
|
33
33
|
*
|
|
34
34
|
* <em style="font-weight: bold;">注意:该方法仅适用于浏览器端,兼容 IE10+ 和现代浏览器。</em>
|
|
35
35
|
*
|
|
@@ -45,8 +45,12 @@ type DownloadOptions = {
|
|
|
45
45
|
* // 文本
|
|
46
46
|
* download('hello world', 'text.txt');
|
|
47
47
|
*
|
|
48
|
-
* // 远程文件
|
|
49
|
-
*
|
|
48
|
+
* // 远程文件1
|
|
49
|
+
* // 不带协议的绝对地址,需要通过 dataType 指定为 url 类型
|
|
50
|
+
* download('/xxx.jpg', { dataType: 'url', fileName: 'test.jpg' });
|
|
51
|
+
*
|
|
52
|
+
* // 远程文件2
|
|
53
|
+
* download('https://example.com/xxx.jpg');
|
|
50
54
|
*
|
|
51
55
|
* // base64
|
|
52
56
|
* download('data:image/png;base64,PGEgaWQ9ImEiPjxiIGlkPSJiIj5oZXkhPC9iPjwvYT4=', 'test.png');
|
package/types/filterTree.d.ts
CHANGED
package/types/isIdCard.d.ts
CHANGED
package/types/treeToList.d.ts
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
* @static
|
|
5
5
|
* @alias module:Tree.treeToList
|
|
6
6
|
* @since 4.14.0
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
* @param {T[]} tree 列表数据
|
|
11
|
-
* @param {K} childrenField 子级字段名称
|
|
12
|
-
* @returns {R[]} 列表数据
|
|
7
|
+
* @param {object[]} tree 树结构数据
|
|
8
|
+
* @param {string} childrenField 子级字段名称
|
|
9
|
+
* @returns {object[]} 列表数据
|
|
13
10
|
* @example
|
|
14
11
|
* const menus = [{ "id": "1", "name": "首页", "code": "trade", "pid": null }, { "id": "2", "name": "交易管理", "code": "trade", "pid": null, "children": [{ "id": "3", "name": "交易查询", "code": "trade-1", "pid": "2", "children": [{ "id": "4", "name": "交易查询-查询操作", "code": "trade-1-1", "pid": "3" }] }] }, { "id": "5", "name": "权限管理", "code": "authorization", "pid": null, "children": [{ "id": "6", "name": "角色管理", "code": "authorization-1", "pid": "5" }, { "id": "7", "name": "用户管理", "code": "authorization-2", "pid": "5" }] }];
|
|
15
12
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 检查值是否为Error、EvalError、RangeError、ReferenceError、SyntaxError、TypeError、URIError|DOMException
|
|
2
|
+
* 检查值是否为Error、EvalError、RangeError、ReferenceError、SyntaxError、TypeError、URIError | DOMException
|
|
3
3
|
*
|
|
4
4
|
* @static
|
|
5
5
|
* @alias module:Type.isError
|
|
6
6
|
* @since 1.1.0
|
|
7
7
|
* @param {*} value 检查值
|
|
8
|
-
* @returns {boolean} 是否为Error、EvalError、RangeError、ReferenceError、SyntaxError、TypeError、URIError|DOMException
|
|
8
|
+
* @returns {boolean} 是否为Error、EvalError、RangeError、ReferenceError、SyntaxError、TypeError、URIError | DOMException
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* isError(new Error)
|