mazey 3.8.0 → 3.8.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.
- package/README.md +48 -53
- package/lib/index.cjs.js +2 -7189
- package/lib/index.d.ts +43 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +265 -155
- package/lib/mazey.min.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -71,20 +71,20 @@ There ara some examples maintained by hand below. For more information, please c
|
|
|
71
71
|
* [isNumber](#isnumber)
|
|
72
72
|
* [isJSONString](#isjsonstring)
|
|
73
73
|
* [isValidData](#isvaliddata)
|
|
74
|
-
* [
|
|
74
|
+
* [genRndNumString](#genrndnumstring)
|
|
75
75
|
* [formatDate](#formatdate)
|
|
76
76
|
* [debounce](#debounce)
|
|
77
77
|
* [throttle](#throttle)
|
|
78
78
|
* [convertCamelToKebab](#convertcameltokebab)
|
|
79
79
|
* [convertCamelToUnder](#convertcameltounder)
|
|
80
|
-
* [
|
|
81
|
-
* [mTrim](#mtrim)
|
|
80
|
+
* [deepCopy](#deepcopy)
|
|
82
81
|
- [URL](#url)
|
|
83
82
|
* [getQueryParam](#getqueryparam)
|
|
84
83
|
* [getUrlParam](#geturlparam)
|
|
85
84
|
* [getHashQueryParam](#gethashqueryparam)
|
|
86
85
|
* [getDomain](#getdomain)
|
|
87
86
|
* [updateQueryParam](#updatequeryparam)
|
|
87
|
+
* [isValidUrl](#isvalidurl)
|
|
88
88
|
- [Cache Data](#cache-data)
|
|
89
89
|
* [Cookie](#cookie)
|
|
90
90
|
* [Storage](#storage)
|
|
@@ -94,8 +94,8 @@ There ara some examples maintained by hand below. For more information, please c
|
|
|
94
94
|
* [newLine](#newline)
|
|
95
95
|
- [Calculate and Formula](#calculate-and-formula)
|
|
96
96
|
* [inRate](#inrate)
|
|
97
|
-
* [
|
|
98
|
-
* [
|
|
97
|
+
* [longestComSubstring](#longestcomsubstring)
|
|
98
|
+
* [longestComSubsequence](#longestcomsubsequence)
|
|
99
99
|
- [Browser Information](#browser-information)
|
|
100
100
|
* [getBrowserInfo](#getbrowserinfo)
|
|
101
101
|
* [isSafePWAEnv](#issafepwaenv)
|
|
@@ -103,6 +103,11 @@ There ara some examples maintained by hand below. For more information, please c
|
|
|
103
103
|
* [getPerformance](#getperformance)
|
|
104
104
|
- [Debug](#debug)
|
|
105
105
|
* [genCustomConsole](#gencustomconsole)
|
|
106
|
+
- [Development Environment](#development-environment)
|
|
107
|
+
* [Node.js](#nodejs)
|
|
108
|
+
* [TypeScript](#typescript)
|
|
109
|
+
- [Scripts](#scripts)
|
|
110
|
+
- [Returns](#returns)
|
|
106
111
|
<!-- toc - end -->
|
|
107
112
|
|
|
108
113
|
### Load Resource
|
|
@@ -308,19 +313,15 @@ isValidDataResC: false
|
|
|
308
313
|
@returns {boolean} Return TRUE if the data is valid.
|
|
309
314
|
@category Util -->
|
|
310
315
|
|
|
311
|
-
####
|
|
316
|
+
#### genRndNumString
|
|
312
317
|
|
|
313
|
-
Produce a random string of number, `
|
|
318
|
+
Produce a random string of number, `genRndNumString(7)` => '7658495'.
|
|
314
319
|
|
|
315
320
|
```
|
|
316
|
-
|
|
317
|
-
|
|
321
|
+
genRndNumString(4); // '9730'
|
|
322
|
+
genRndNumString(7); // '2262490'
|
|
318
323
|
```
|
|
319
324
|
|
|
320
|
-
<!-- @param {number} n Length
|
|
321
|
-
@returns {string} Return the random string.
|
|
322
|
-
@category Util -->
|
|
323
|
-
|
|
324
325
|
#### formatDate
|
|
325
326
|
|
|
326
327
|
Return the formatted date string in the given format.
|
|
@@ -404,15 +405,15 @@ convertCamelToUnder('aBC'); // a_b_c
|
|
|
404
405
|
@returns {string} 'a_b_c'
|
|
405
406
|
@category Util -->
|
|
406
407
|
|
|
407
|
-
####
|
|
408
|
+
#### deepCopy
|
|
408
409
|
|
|
409
|
-
Clone Object deeply.
|
|
410
|
+
Copy/Clone Object deeply.
|
|
410
411
|
|
|
411
412
|
Usage:
|
|
412
413
|
|
|
413
414
|
```
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
deepCopy(['a', 'b', 'c']);
|
|
416
|
+
deepCopy('abc');
|
|
416
417
|
```
|
|
417
418
|
|
|
418
419
|
Output:
|
|
@@ -422,23 +423,6 @@ Output:
|
|
|
422
423
|
'abc'
|
|
423
424
|
```
|
|
424
425
|
|
|
425
|
-
<!-- @param {object} obj The value to clone.
|
|
426
|
-
@returns {object} Returns the deep cloned value.
|
|
427
|
-
@category Util -->
|
|
428
|
-
|
|
429
|
-
#### mTrim
|
|
430
|
-
|
|
431
|
-
Remove leading and trailing whitespace or specified characters from string.
|
|
432
|
-
|
|
433
|
-
```
|
|
434
|
-
mTrim(' 1 2 3 '); // '1 2 3'
|
|
435
|
-
mTrim('abc '); // 'abc'
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
<!-- @param {string} str The string to trim.
|
|
439
|
-
@returns {string} Trimmed string.
|
|
440
|
-
@category Util -->
|
|
441
|
-
|
|
442
426
|
### URL
|
|
443
427
|
|
|
444
428
|
#### getQueryParam
|
|
@@ -548,6 +532,18 @@ http://example.com/?t1=1&t2=2&t3=3&t4=four
|
|
|
548
532
|
@returns {string} URL.
|
|
549
533
|
@category URL -->
|
|
550
534
|
|
|
535
|
+
#### isValidUrl
|
|
536
|
+
|
|
537
|
+
Checks if the given string is a valid URL, including scheme URLs.
|
|
538
|
+
|
|
539
|
+
```js
|
|
540
|
+
isValidUrl('https://www.example.com'); // true
|
|
541
|
+
isValidUrl('http://example.com/path/exx/ss'); // true
|
|
542
|
+
isValidUrl('https://www.example.com/?q=hello&age=24#world'); // true
|
|
543
|
+
isValidUrl('http://www.example.com/#world?id=9'); // true
|
|
544
|
+
isValidUrl('ftp://example.com'); // true
|
|
545
|
+
```
|
|
546
|
+
|
|
551
547
|
### Cache Data
|
|
552
548
|
|
|
553
549
|
#### Cookie
|
|
@@ -707,16 +703,14 @@ console.log(trueCount, falseCount); // 499994 500006
|
|
|
707
703
|
@returns {boolean} true 命中
|
|
708
704
|
@category Calculate and Formula -->
|
|
709
705
|
|
|
710
|
-
####
|
|
706
|
+
#### longestComSubstring
|
|
711
707
|
|
|
712
708
|
Computes the longest common substring of two strings.
|
|
713
709
|
|
|
714
|
-
<!-- ZH: 计算两个字符串的最长公共子串 -->
|
|
715
|
-
|
|
716
710
|
Usage:
|
|
717
711
|
|
|
718
712
|
```
|
|
719
|
-
|
|
713
|
+
longestComSubstring('fish', 'finish');
|
|
720
714
|
```
|
|
721
715
|
|
|
722
716
|
Output:
|
|
@@ -725,21 +719,14 @@ Output:
|
|
|
725
719
|
3
|
|
726
720
|
```
|
|
727
721
|
|
|
728
|
-
|
|
729
|
-
@param {string} bStr String
|
|
730
|
-
@returns {number} Length
|
|
731
|
-
@category Calculate and Formula -->
|
|
732
|
-
|
|
733
|
-
#### calLongestCommonSubsequence
|
|
722
|
+
#### longestComSubsequence
|
|
734
723
|
|
|
735
724
|
Computes the longest common subsequence of two strings.
|
|
736
725
|
|
|
737
|
-
<!-- ZH: 计算两个字符串的最长公共子序列 -->
|
|
738
|
-
|
|
739
726
|
Usage:
|
|
740
727
|
|
|
741
728
|
```
|
|
742
|
-
|
|
729
|
+
longestComSubsequence('fish', 'finish');
|
|
743
730
|
```
|
|
744
731
|
|
|
745
732
|
Output:
|
|
@@ -748,11 +735,6 @@ Output:
|
|
|
748
735
|
4
|
|
749
736
|
```
|
|
750
737
|
|
|
751
|
-
<!-- @param {string} aStr 字符串
|
|
752
|
-
@param {string} bStr 字符串
|
|
753
|
-
@returns {number} 长度
|
|
754
|
-
@category Calculate and Formula -->
|
|
755
|
-
|
|
756
738
|
### Browser Information
|
|
757
739
|
|
|
758
740
|
#### getBrowserInfo
|
|
@@ -901,6 +883,19 @@ MazeyLog: I am object. {a: 123, b: 456}
|
|
|
901
883
|
|
|
902
884
|
## Contributing
|
|
903
885
|
|
|
886
|
+
### Development Environment
|
|
887
|
+
|
|
888
|
+
#### Node.js
|
|
889
|
+
|
|
890
|
+
- v14.21.3
|
|
891
|
+
- v14.7.0
|
|
892
|
+
|
|
893
|
+
#### TypeScript
|
|
894
|
+
|
|
895
|
+
- v4.4.4
|
|
896
|
+
|
|
897
|
+
### Scripts
|
|
898
|
+
|
|
904
899
|
```
|
|
905
900
|
# Install
|
|
906
901
|
npm i
|
|
@@ -918,7 +913,7 @@ npm run docs
|
|
|
918
913
|
npm run test
|
|
919
914
|
```
|
|
920
915
|
|
|
921
|
-
Returns
|
|
916
|
+
### Returns
|
|
922
917
|
|
|
923
918
|
| Values | Description | Type |
|
|
924
919
|
| :-------- | :--------------------------------------- | :------ |
|