@zcrkey/js-utils 0.0.4 → 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 +60 -56
- 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/treeUtil.d.ts +48 -0
- package/dist/treeUtil.js +185 -0
- package/dist/util.d.ts +41 -6
- package/dist/util.js +117 -6
- 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 +3 -5
- 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
|
@@ -1,56 +1,60 @@
|
|
|
1
|
-
# @zcrkey/js-utils
|
|
2
|
-
|
|
3
|
-
一个 javascript 实用函数库
|
|
4
|
-
|
|
5
|
-
## 安装和使用
|
|
6
|
-
|
|
7
|
-
### 通过 import 方式安装
|
|
8
|
-
|
|
9
|
-
在开始之前,你可能需要安装 [yarn](https://github.com/yarnpkg/yarn/) 或者 [pnpm](https://pnpm.io/zh/)。
|
|
10
|
-
|
|
11
|
-
从 yarn 或 npm 或 pnpm 安装并引入
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
$ yarn add @zcrkey/js-utils
|
|
15
|
-
# or
|
|
16
|
-
$ npm install @zcrkey/js-utils --save
|
|
17
|
-
# or
|
|
18
|
-
$ pnpm install @zcrkey/js-utils --save
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
修改 `src/App.js`,引入 @zcrkey/js-utils 。
|
|
23
|
-
|
|
24
|
-
```jsx
|
|
25
|
-
import React from 'react';
|
|
26
|
-
import { CrUtil } from '@zcrkey/js-utils';
|
|
27
|
-
|
|
28
|
-
const App = () => (
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
console.log(CrUtil.trim(' @zcrkey/js-utils '))
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
<div className="App">
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export default App;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 通过独立版本安装
|
|
42
|
-
|
|
43
|
-
- 下载 @zcrkey/js-utils 的独立版本文件(如 index.umd.js)
|
|
44
|
-
- 在 HTML 文件的 \<head\> 或 \<body\> 部分添加 \<script\> 标签,并指向下载的 @zcrkey/js-utils 文件
|
|
45
|
-
- 在 HTML 文件中使用 @zcrkey/js-utils
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
<script src="./index.umd.js"></script>
|
|
49
|
-
<script>
|
|
50
|
-
console.log(CrUtil.trim(' @zcrkey/js-utils '))
|
|
51
|
-
</script>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
# @zcrkey/js-utils
|
|
2
|
+
|
|
3
|
+
一个 javascript 实用函数库
|
|
4
|
+
|
|
5
|
+
## 安装和使用
|
|
6
|
+
|
|
7
|
+
### 通过 import 方式安装
|
|
8
|
+
|
|
9
|
+
在开始之前,你可能需要安装 [yarn](https://github.com/yarnpkg/yarn/) 或者 [pnpm](https://pnpm.io/zh/)。
|
|
10
|
+
|
|
11
|
+
从 yarn 或 npm 或 pnpm 安装并引入
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
$ yarn add @zcrkey/js-utils
|
|
15
|
+
# or
|
|
16
|
+
$ npm install @zcrkey/js-utils --save
|
|
17
|
+
# or
|
|
18
|
+
$ pnpm install @zcrkey/js-utils --save
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
修改 `src/App.js`,引入 @zcrkey/js-utils 。
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { CrUtil } from '@zcrkey/js-utils';
|
|
27
|
+
|
|
28
|
+
const App = () => (
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
console.log(CrUtil.trim(' @zcrkey/js-utils '))
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
<div className="App">
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export default App;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 通过独立版本安装
|
|
42
|
+
|
|
43
|
+
- 下载 @zcrkey/js-utils 的独立版本文件(如 index.umd.js)
|
|
44
|
+
- 在 HTML 文件的 \<head\> 或 \<body\> 部分添加 \<script\> 标签,并指向下载的 @zcrkey/js-utils 文件
|
|
45
|
+
- 在 HTML 文件中使用 @zcrkey/js-utils
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
<script src="./index.umd.js"></script>
|
|
49
|
+
<script>
|
|
50
|
+
console.log(CrUtil.trim(' @zcrkey/js-utils '))
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 更新日志
|
|
55
|
+
|
|
56
|
+
请查看 [CHANGELOG.md](https://cnb.cool/cnbkey/zcrkey/js-utils/-/blob/master/CHANGELOG.md) 获取版本更新详情。
|
|
57
|
+
|
|
58
|
+
## LICENSE
|
|
59
|
+
|
|
60
|
+
MIT
|
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