devix 0.0.21 → 0.0.23-beta.1
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 +25 -25
- package/dist/index.cjs.js +304 -156
- package/dist/index.esm.js +290 -156
- package/{dist/index.d.ts → index.d.ts} +18 -49
- package/lib/cache/index.cjs.js +38 -0
- package/lib/cache/index.esm.js +35 -0
- package/package.json +27 -34
- package/dist/index.umd.js +0 -158
package/README.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
# devix
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Devix is a comprehensive, powerful, and compact JavaScript utility library.( English | [简体中文](README.md) )
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Please make sure you install this library using npm or another package manager in a Node.js environment.
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
10
|
npm install --save-dev devix
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Then, utilize modern module bundling tools such as Vite or Webpack to import this library using modular syntax.
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
//
|
|
16
|
+
// Using ES Module
|
|
17
17
|
import { [[ModuleName]] } from 'devix'
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Using CommonJS
|
|
20
20
|
const { [[ModuleName]] } = require('devix')
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Usage
|
|
24
24
|
|
|
25
25
|
```javascript
|
|
26
26
|
import { localCache, bubblingSort, isType } from 'devix'
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// Using localCache
|
|
29
29
|
localCache.setCache('userInfo', { name: 'king', age: 18 })
|
|
30
30
|
const userInfo = localCache.get('userInfo')
|
|
31
31
|
console.log('userInfo', userInfo)
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// Using bubblingSort、
|
|
34
34
|
const arr1 = [123, 346, 62, 2456, 56123, 1, 64, 61, 453, 72345]
|
|
35
35
|
const sortArr1 = bubblingSort(arr1, 'DESC')
|
|
36
36
|
console.log('sortArr1', sortArr1)
|
|
@@ -43,7 +43,7 @@ const arr2 = [
|
|
|
43
43
|
const sortArr2 = bubblingSort(arr2, 'DESC', 'age')
|
|
44
44
|
console.log('sortArr2', sortArr2)
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Using isType
|
|
47
47
|
console.log(`isType(userInfo,'object') -> true`, isType(userInfo, 'object'))
|
|
48
48
|
console.log(
|
|
49
49
|
`isType(userInfo.name,'string') -> true`,
|
|
@@ -52,51 +52,51 @@ console.log(
|
|
|
52
52
|
console.log(`isType(userInfo.age,'number') -> true`, isType(userInfo, 'number'))
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
##
|
|
55
|
+
## API
|
|
56
56
|
|
|
57
|
-
###
|
|
57
|
+
### Cache Apis
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Provides methods related to cache operations.
|
|
60
60
|
|
|
61
61
|
- localCache
|
|
62
62
|
- sessionCache
|
|
63
63
|
|
|
64
|
-
###
|
|
64
|
+
### Clone Apis
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Methods for data cloning operations.
|
|
67
67
|
|
|
68
68
|
- deepClone
|
|
69
69
|
- shallowClone
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### Retalimit Apis
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Includes methods for controlling the frequency of operations.
|
|
74
74
|
|
|
75
75
|
- throttle
|
|
76
76
|
- debounce
|
|
77
77
|
|
|
78
|
-
###
|
|
78
|
+
### Sort Apis
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Offers methods for various sorting operations.
|
|
81
81
|
|
|
82
82
|
- bubblingSort
|
|
83
83
|
|
|
84
|
-
###
|
|
84
|
+
### Time Apis
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
Consists of methods for handling time-related operations.
|
|
87
87
|
|
|
88
88
|
- formatTimer
|
|
89
89
|
- setTimer
|
|
90
90
|
|
|
91
|
-
###
|
|
91
|
+
### Typeof Apis
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Methods for data type detection.
|
|
94
94
|
|
|
95
95
|
- isType
|
|
96
96
|
|
|
97
|
-
###
|
|
97
|
+
### Other Apis
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
Includes a variety of other functional functions and methods.
|
|
100
100
|
|
|
101
101
|
- compose
|
|
102
102
|
- currying
|