@zcrkey/js-utils 0.0.3 → 0.0.5
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/.dumi/global.less +1396 -0
- package/.dumirc.ts +36 -0
- package/.fatherrc.ts +14 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +2 -0
- package/.stylelintrc +10 -0
- package/README.md +4 -0
- package/dist/eventCenter.js +36 -36
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/index.umd.js +1 -1
- package/dist/objUtil.d.ts +12 -0
- package/dist/objUtil.js +28 -0
- package/dist/storage.js +26 -26
- package/dist/treeUtil.d.ts +48 -0
- package/dist/treeUtil.js +185 -0
- package/dist/util.d.ts +50 -6
- package/dist/util.js +218 -33
- package/docs/api/eventCenter/index.md +34 -0
- package/docs/api/index.md +5 -0
- package/docs/api/storage/index.md +9 -0
- package/docs/api/storage/local.tsx +91 -0
- package/docs/api/storage/session.tsx +85 -0
- package/docs/api/treeUtil/index.md +5 -0
- package/docs/api/treeUtil/index.tsx +266 -0
- package/docs/api/util/index.md +6 -0
- package/docs/api/util/index.tsx +405 -0
- package/docs/api/util/is.tsx +196 -0
- package/docs/guide.md +24 -0
- package/package.json +6 -4
- package/src/eventCenter.ts +112 -0
- package/src/index.ts +8 -0
- package/src/objUtil.ts +20 -0
- package/src/storage.ts +101 -0
- package/src/treeUtil.ts +164 -0
- package/src/util.ts +656 -0
- package/tsconfig.json +18 -0
package/.dumirc.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from 'dumi';
|
|
2
|
+
|
|
3
|
+
// more config: https://d.umijs.org/config
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
outputPath: 'docs-dist',
|
|
6
|
+
themeConfig: {
|
|
7
|
+
name: '@zcrkey/js-utils',
|
|
8
|
+
nav: {
|
|
9
|
+
'zh-CN': [
|
|
10
|
+
{ title: '指南', link: '/guide' },
|
|
11
|
+
{ title: 'API', link: '/api' },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
footer: 'zcrkey | Copyright © 2023-present</span>',
|
|
15
|
+
title: '@zcrkey/js-utils',
|
|
16
|
+
description: {
|
|
17
|
+
'zh-CN': '一个 javascript 实用函数库',
|
|
18
|
+
},
|
|
19
|
+
actions: {
|
|
20
|
+
'zh-CN': [
|
|
21
|
+
{
|
|
22
|
+
type: 'primary',
|
|
23
|
+
text: '开始使用',
|
|
24
|
+
link: '/guide',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: 'API总览',
|
|
28
|
+
link: '/api',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
socialLinks: {
|
|
33
|
+
github: 'https://cnb.cool/cnbkey/zcrkey/js-utils.git',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
package/.fatherrc.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'father';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
|
|
5
|
+
esm: {
|
|
6
|
+
output: 'dist',
|
|
7
|
+
},
|
|
8
|
+
umd: {
|
|
9
|
+
output: {
|
|
10
|
+
path: 'dist',
|
|
11
|
+
filename: 'index.umd.js',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
package/.prettierignore
ADDED
package/.stylelintrc
ADDED
package/README.md
CHANGED
package/dist/eventCenter.js
CHANGED
|
@@ -12,14 +12,14 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
12
12
|
_createClass(CrEventCenter, null, [{
|
|
13
13
|
key: "on",
|
|
14
14
|
value:
|
|
15
|
-
/**
|
|
16
|
-
* 新增订阅
|
|
17
|
-
*
|
|
18
|
-
* @param {*} key 名称
|
|
19
|
-
* @param {*} listener 执行函数
|
|
20
|
-
* @returns 订阅信息
|
|
21
|
-
* @example
|
|
22
|
-
this.subscription = CrEventCenter.on('名称', (参数) => {});
|
|
15
|
+
/**
|
|
16
|
+
* 新增订阅
|
|
17
|
+
*
|
|
18
|
+
* @param {*} key 名称
|
|
19
|
+
* @param {*} listener 执行函数
|
|
20
|
+
* @returns 订阅信息
|
|
21
|
+
* @example
|
|
22
|
+
this.subscription = CrEventCenter.on('名称', (参数) => {});
|
|
23
23
|
*/
|
|
24
24
|
function on(key, listener) {
|
|
25
25
|
var _this = this;
|
|
@@ -44,13 +44,13 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
44
44
|
return subscription;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* 移除订阅
|
|
49
|
-
*
|
|
50
|
-
* @param {*} subscription
|
|
51
|
-
* @param {*} type 'all'
|
|
52
|
-
* @example
|
|
53
|
-
CrEventCenter.off(this.subscription);
|
|
47
|
+
/**
|
|
48
|
+
* 移除订阅
|
|
49
|
+
*
|
|
50
|
+
* @param {*} subscription
|
|
51
|
+
* @param {*} type 'all'
|
|
52
|
+
* @example
|
|
53
|
+
CrEventCenter.off(this.subscription);
|
|
54
54
|
*/
|
|
55
55
|
}, {
|
|
56
56
|
key: "off",
|
|
@@ -73,13 +73,13 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* 派发事件
|
|
78
|
-
*
|
|
79
|
-
* @param {*} key 名称
|
|
80
|
-
* @param {*} args 其余参数
|
|
81
|
-
* @example
|
|
82
|
-
CrEventCenter.emit('名称', 参数数据);
|
|
76
|
+
/**
|
|
77
|
+
* 派发事件
|
|
78
|
+
*
|
|
79
|
+
* @param {*} key 名称
|
|
80
|
+
* @param {*} args 其余参数
|
|
81
|
+
* @example
|
|
82
|
+
CrEventCenter.emit('名称', 参数数据);
|
|
83
83
|
*/
|
|
84
84
|
}, {
|
|
85
85
|
key: "emit",
|
|
@@ -97,12 +97,12 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* 查找事件
|
|
102
|
-
*
|
|
103
|
-
* @param {*} key 名称
|
|
104
|
-
* @example
|
|
105
|
-
let subscriber = CrEventCenter.find('名称');
|
|
100
|
+
/**
|
|
101
|
+
* 查找事件
|
|
102
|
+
*
|
|
103
|
+
* @param {*} key 名称
|
|
104
|
+
* @example
|
|
105
|
+
let subscriber = CrEventCenter.find('名称');
|
|
106
106
|
*/
|
|
107
107
|
}, {
|
|
108
108
|
key: "find",
|
|
@@ -112,12 +112,12 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
/**
|
|
116
|
-
* 清理所有事件
|
|
117
|
-
*
|
|
118
|
-
* @memberof CrEventCenter
|
|
119
|
-
* @example
|
|
120
|
-
CrEventCenter.clear();
|
|
115
|
+
/**
|
|
116
|
+
* 清理所有事件
|
|
117
|
+
*
|
|
118
|
+
* @memberof CrEventCenter
|
|
119
|
+
* @example
|
|
120
|
+
CrEventCenter.clear();
|
|
121
121
|
*/
|
|
122
122
|
}, {
|
|
123
123
|
key: "clear",
|
|
@@ -127,8 +127,8 @@ var CrEventCenter = /*#__PURE__*/function () {
|
|
|
127
127
|
}]);
|
|
128
128
|
return CrEventCenter;
|
|
129
129
|
}();
|
|
130
|
-
/**
|
|
131
|
-
* 储存订阅者
|
|
130
|
+
/**
|
|
131
|
+
* 储存订阅者
|
|
132
132
|
*/
|
|
133
133
|
_defineProperty(CrEventCenter, "subscribers", []);
|
|
134
134
|
export { CrEventCenter as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export type * from './eventCenter';
|
|
1
2
|
export { default as CrEventCenter } from './eventCenter';
|
|
2
|
-
export type
|
|
3
|
+
export type * from './objUtil';
|
|
4
|
+
export { default as CrObjUtil } from './objUtil';
|
|
3
5
|
export { default as CrStorage } from './storage';
|
|
6
|
+
export type * from './treeUtil';
|
|
7
|
+
export { default as CrTreeUtil } from './treeUtil';
|
|
4
8
|
export { default as CrUtil } from './util';
|
package/dist/index.js
CHANGED