mazey 3.5.1 → 3.5.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/README.md +51 -51
- package/lib/index.cjs.js +5607 -2
- package/lib/index.d.ts +11 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +5553 -2
- package/lib/mazey.min.js +2 -2
- package/package.json +2 -2
- package/src/index.ts +12 -12
- package/src/t.html +0 -18
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ English | [简体中文](https://github.com/mazeyqian/mazey/blob/master/README_C
|
|
|
10
10
|
[l-image]: https://img.shields.io/npm/l/mazey
|
|
11
11
|
[l-url]: https://github.com/mazeyqian/mazey
|
|
12
12
|
|
|
13
|
-
Mazey's functional library for daily front-end work. There are already many excellent libraries for front-end development, but creating a file named UtilsJS or CommonJS is generally used to supply common functions in projects. It's boring to copy similar functions among projects again and again. I will consistently update the library during my work life to save time.
|
|
13
|
+
Mazey's functional library for daily front-end work. There are already many excellent libraries for front-end development, but creating a file named UtilsJS or CommonJS is generally used to supply common functions in projects. It's boring to copy similar functions among projects again and again. Therefore, I will consistently update the library during my work life to save time.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -45,59 +45,59 @@ Import from CDN.
|
|
|
45
45
|
```
|
|
46
46
|
<script type="text/javascript" src="//i.mazey.net/mazey/lib/mazey.min.js"></script>
|
|
47
47
|
<script>
|
|
48
|
-
mazey.isNumber(Infinity, { isUnFiniteAsNumber: true }); // true
|
|
48
|
+
mazey.isNumber(Infinity, { isUnFiniteAsNumber: true }); // true
|
|
49
49
|
</script>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## API Examples
|
|
53
53
|
|
|
54
|
-
There ara some examples maintained by hand below. For more information, please check the [full documentation](https://
|
|
54
|
+
There ara some examples maintained by hand below. For more information, please check the [full documentation](https://mazey.cn/t/m).
|
|
55
55
|
|
|
56
56
|
**Table of Contents**
|
|
57
57
|
|
|
58
|
-
<!-- toc - begin -->
|
|
59
|
-
- Generated with ❤️
|
|
60
|
-
- [Load Resource](#load-resource)
|
|
61
|
-
* [loadScript](#loadscript)
|
|
62
|
-
* [loadCSS](#loadcss)
|
|
63
|
-
* [windowLoaded](#windowloaded)
|
|
64
|
-
- [Function](#function)
|
|
65
|
-
* [debounce](#debounce)
|
|
66
|
-
* [throttle](#throttle)
|
|
67
|
-
* [isNumber](#isnumber)
|
|
68
|
-
* [camelCaseToKebabCase](#camelcasetokebabcase)
|
|
69
|
-
* [camelCase2Underscore](#camelcase2underscore)
|
|
70
|
-
* [mTrim](#mtrim)
|
|
71
|
-
* [deepCopyObject](#deepcopyobject)
|
|
72
|
-
* [isJsonString](#isjsonstring)
|
|
73
|
-
* [generateRndNum](#generaterndnum)
|
|
74
|
-
* [formatDate](#formatdate)
|
|
75
|
-
* [isValidData](#isvaliddata)
|
|
76
|
-
- [DOM](#dom)
|
|
77
|
-
* [Class](#class)
|
|
78
|
-
* [addStyle](#addstyle)
|
|
79
|
-
* [newLine](#newline)
|
|
80
|
-
- [URL](#url)
|
|
81
|
-
* [getQueryParam](#getqueryparam)
|
|
82
|
-
* [getUrlParam](#geturlparam)
|
|
83
|
-
* [updateQueryParam](#updatequeryparam)
|
|
84
|
-
* [getHashQueryParam](#gethashqueryparam)
|
|
85
|
-
* [getDomain](#getdomain)
|
|
86
|
-
- [Cache Data](#cache-data)
|
|
87
|
-
* [Storage](#storage)
|
|
88
|
-
* [Cookie](#cookie)
|
|
89
|
-
- [Calculate and Formula](#calculate-and-formula)
|
|
90
|
-
* [inRate](#inrate)
|
|
91
|
-
* [calLongestCommonSubstring](#callongestcommonsubstring)
|
|
92
|
-
* [calLongestCommonSubsequence](#callongestcommonsubsequence)
|
|
93
|
-
- [Browser Information](#browser-information)
|
|
94
|
-
* [getBrowserInfo](#getbrowserinfo)
|
|
95
|
-
- [Web Performance](#web-performance)
|
|
96
|
-
* [getPerformance](#getperformance)
|
|
97
|
-
- [Margin of Safety](#margin-of-safety)
|
|
98
|
-
* [isSafePWAEnv](#issafepwaenv)
|
|
99
|
-
- [Debug](#debug)
|
|
100
|
-
* [genCustomConsole](#gencustomconsole)
|
|
58
|
+
<!-- toc - begin -->
|
|
59
|
+
- Generated with ❤️
|
|
60
|
+
- [Load Resource](#load-resource)
|
|
61
|
+
* [loadScript](#loadscript)
|
|
62
|
+
* [loadCSS](#loadcss)
|
|
63
|
+
* [windowLoaded](#windowloaded)
|
|
64
|
+
- [Function](#function)
|
|
65
|
+
* [debounce](#debounce)
|
|
66
|
+
* [throttle](#throttle)
|
|
67
|
+
* [isNumber](#isnumber)
|
|
68
|
+
* [camelCaseToKebabCase](#camelcasetokebabcase)
|
|
69
|
+
* [camelCase2Underscore](#camelcase2underscore)
|
|
70
|
+
* [mTrim](#mtrim)
|
|
71
|
+
* [deepCopyObject](#deepcopyobject)
|
|
72
|
+
* [isJsonString](#isjsonstring)
|
|
73
|
+
* [generateRndNum](#generaterndnum)
|
|
74
|
+
* [formatDate](#formatdate)
|
|
75
|
+
* [isValidData](#isvaliddata)
|
|
76
|
+
- [DOM](#dom)
|
|
77
|
+
* [Class](#class)
|
|
78
|
+
* [addStyle](#addstyle)
|
|
79
|
+
* [newLine](#newline)
|
|
80
|
+
- [URL](#url)
|
|
81
|
+
* [getQueryParam](#getqueryparam)
|
|
82
|
+
* [getUrlParam](#geturlparam)
|
|
83
|
+
* [updateQueryParam](#updatequeryparam)
|
|
84
|
+
* [getHashQueryParam](#gethashqueryparam)
|
|
85
|
+
* [getDomain](#getdomain)
|
|
86
|
+
- [Cache Data](#cache-data)
|
|
87
|
+
* [Storage](#storage)
|
|
88
|
+
* [Cookie](#cookie)
|
|
89
|
+
- [Calculate and Formula](#calculate-and-formula)
|
|
90
|
+
* [inRate](#inrate)
|
|
91
|
+
* [calLongestCommonSubstring](#callongestcommonsubstring)
|
|
92
|
+
* [calLongestCommonSubsequence](#callongestcommonsubsequence)
|
|
93
|
+
- [Browser Information](#browser-information)
|
|
94
|
+
* [getBrowserInfo](#getbrowserinfo)
|
|
95
|
+
- [Web Performance](#web-performance)
|
|
96
|
+
* [getPerformance](#getperformance)
|
|
97
|
+
- [Margin of Safety](#margin-of-safety)
|
|
98
|
+
* [isSafePWAEnv](#issafepwaenv)
|
|
99
|
+
- [Debug](#debug)
|
|
100
|
+
* [genCustomConsole](#gencustomconsole)
|
|
101
101
|
<!-- toc - end -->
|
|
102
102
|
|
|
103
103
|
### Load Resource
|
|
@@ -716,9 +716,9 @@ Get page load time(PerformanceTiming).
|
|
|
716
716
|
Usage:
|
|
717
717
|
|
|
718
718
|
```
|
|
719
|
-
// `camelCase:
|
|
720
|
-
// `camelCase:
|
|
721
|
-
getPerformance(
|
|
719
|
+
// `camelCase:false` (Default) Return underline data.
|
|
720
|
+
// `camelCase:true` Return hump data.
|
|
721
|
+
getPerformance()
|
|
722
722
|
.then(res => {
|
|
723
723
|
console.log(JSON.stringify(res));
|
|
724
724
|
})
|
|
@@ -728,7 +728,7 @@ getPerformance(true)
|
|
|
728
728
|
Output:
|
|
729
729
|
|
|
730
730
|
```
|
|
731
|
-
{"
|
|
731
|
+
{"os":"ios","os_version":"13_2_3","device_type":"phone","network":"4g","unload_time":0,"redirect_time":0,"dns_time":0,"tcp_time":0,"response_time":289,"download_time":762,"first_paint_time":469,"first_contentful_paint_time":469,"domready_time":1318,"onload_time":2767,"white_time":299,"render_time":2768,"decoded_body_size":979570,"encoded_body_size":324938}
|
|
732
732
|
```
|
|
733
733
|
|
|
734
734
|
Results:
|
|
@@ -747,7 +747,7 @@ Results:
|
|
|
747
747
|
| SSL | ssl_time | (Optional) connectEnd - secureConnectionStart |
|
|
748
748
|
| Download | download_time | (Optional) responseEnd - responseStart |
|
|
749
749
|
|
|
750
|
-
<!-- @param {boolean} camelCase --
|
|
750
|
+
<!-- @param {boolean} camelCase -- false(默认) 以下划线形式返回数据 true 以驼峰形式返回数据
|
|
751
751
|
@returns {Promise<object>} 加载数据 -->
|
|
752
752
|
|
|
753
753
|
### Margin of Safety
|