mazey 4.7.10 → 4.7.11
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 +1 -1
- package/lib/browser.d.ts +10 -1
- package/lib/browser.d.ts.map +1 -1
- package/lib/calc.d.ts +7 -1
- package/lib/calc.d.ts.map +1 -1
- package/lib/debug.d.ts +18 -10
- package/lib/debug.d.ts.map +1 -1
- package/lib/dom.d.ts +13 -8
- package/lib/dom.d.ts.map +1 -1
- package/lib/event.d.ts +17 -2
- package/lib/event.d.ts.map +1 -1
- package/lib/index.cjs.js +3 -3
- package/lib/index.esm.js +3 -3
- package/lib/load.d.ts +11 -1
- package/lib/load.d.ts.map +1 -1
- package/lib/mazey.min.js +3 -3
- package/lib/perf.d.ts +14 -0
- package/lib/perf.d.ts.map +1 -1
- package/lib/store.d.ts +14 -0
- package/lib/store.d.ts.map +1 -1
- package/lib/url.d.ts +24 -0
- package/lib/url.d.ts.map +1 -1
- package/lib/util.d.ts +71 -3
- package/lib/util.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/url.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { SingleValueUrlParams } from "./typing";
|
|
|
5
5
|
* Usage:
|
|
6
6
|
*
|
|
7
7
|
* ```javascript
|
|
8
|
+
* import { getQueryParam } from "mazey";
|
|
9
|
+
*
|
|
8
10
|
* // http://example.com/?t1=1&t2=2&t3=3&t4=4#2333
|
|
9
11
|
* // ?t1=1&t2=2&t3=3&t4=4
|
|
10
12
|
* const p1 = getQueryParam("t3");
|
|
@@ -29,6 +31,8 @@ export declare function getQueryParam(param: string): string;
|
|
|
29
31
|
* Usage:
|
|
30
32
|
*
|
|
31
33
|
* ```javascript
|
|
34
|
+
* import { getAllQueryParams } from "mazey";
|
|
35
|
+
*
|
|
32
36
|
* // http://example.com/?t1=1&t2=2&t3=3&t4=4#2333
|
|
33
37
|
* // ?t1=1&t2=2&t3=3&t4=4
|
|
34
38
|
* const ret = getAllQueryParams();
|
|
@@ -52,6 +56,8 @@ export declare function getAllQueryParams(url?: string): SingleValueUrlParams;
|
|
|
52
56
|
* Usage:
|
|
53
57
|
*
|
|
54
58
|
* ```javascript
|
|
59
|
+
* import { getUrlParam } from "mazey";
|
|
60
|
+
*
|
|
55
61
|
* const p1 = getUrlParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t3");
|
|
56
62
|
* const p2 = getUrlParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t4");
|
|
57
63
|
* console.log(p1, p2);
|
|
@@ -79,6 +85,8 @@ export declare function getUrlParam(url: string, param: string, options?: {
|
|
|
79
85
|
* Usage:
|
|
80
86
|
*
|
|
81
87
|
* ```javascript
|
|
88
|
+
* import { updateQueryParam } from "mazey";
|
|
89
|
+
*
|
|
82
90
|
* const ret1 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t3", "three");
|
|
83
91
|
* const ret2 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t4", "four");
|
|
84
92
|
* console.log(ret1);
|
|
@@ -105,6 +113,8 @@ export declare function updateQueryParam(url: string, param: string, value: stri
|
|
|
105
113
|
* Usage:
|
|
106
114
|
*
|
|
107
115
|
* ```javascript
|
|
116
|
+
* import { getHashQueryParam } from "mazey";
|
|
117
|
+
*
|
|
108
118
|
* // http://example.com/?#2333?t1=1&t2=2&t3=3&t4=4
|
|
109
119
|
* // #2333?t1=1&t2=2&t3=3&t4=4
|
|
110
120
|
* const p1 = getHashQueryParam("t3");
|
|
@@ -129,6 +139,8 @@ export declare function getHashQueryParam(param: string): string;
|
|
|
129
139
|
* Usage:
|
|
130
140
|
*
|
|
131
141
|
* ```javascript
|
|
142
|
+
* import { getDomain } from "mazey";
|
|
143
|
+
*
|
|
132
144
|
* const ret1 = getDomain("http://example.com/?t1=1&t2=2&t3=3&t4=4");
|
|
133
145
|
* const ret2 = getDomain("http://example.com/test/thanks?t1=1&t2=2&t3=3&t4=4", ["hostname", "pathname"]);
|
|
134
146
|
* const ret3 = getDomain("http://example.com:7890/test/thanks", ["hostname"]);
|
|
@@ -165,6 +177,8 @@ export declare function getDomain(url: string, rules?: string[]): string;
|
|
|
165
177
|
* Usage:
|
|
166
178
|
*
|
|
167
179
|
* ```javascript
|
|
180
|
+
* import { isValidUrl } from "mazey";
|
|
181
|
+
*
|
|
168
182
|
* const ret1 = isValidUrl("https://www.example.com");
|
|
169
183
|
* const ret2 = isValidUrl("http://example.com/path/exx/ss");
|
|
170
184
|
* const ret3 = isValidUrl("https://www.example.com/?q=hello&age=24#world");
|
|
@@ -194,6 +208,8 @@ export declare function isValidUrl(url: string): boolean;
|
|
|
194
208
|
* Usage:
|
|
195
209
|
*
|
|
196
210
|
* ```javascript
|
|
211
|
+
* import { isValidHttpUrl } from "mazey";
|
|
212
|
+
*
|
|
197
213
|
* const ret1 = isValidHttpUrl("https://www.example.com");
|
|
198
214
|
* const ret2 = isValidHttpUrl("http://example.com/path/exx/ss");
|
|
199
215
|
* const ret3 = isValidHttpUrl("https://www.example.com/?q=hello&age=24#world");
|
|
@@ -225,6 +241,8 @@ export declare function isValidHttpUrl(url: string, options?: {
|
|
|
225
241
|
* Usage:
|
|
226
242
|
*
|
|
227
243
|
* ```javascript
|
|
244
|
+
* import { getUrlFileType } from "mazey";
|
|
245
|
+
*
|
|
228
246
|
* const ret1 = getUrlFileType("https://example.com/a/b/c.png");
|
|
229
247
|
* const ret2 = getUrlFileType("https://example.com/a/b/c.jpg");
|
|
230
248
|
* const ret3 = getUrlFileType("https://example.com/a/b/c.jpeg");
|
|
@@ -250,6 +268,8 @@ export declare function getUrlFileType(url: string): boolean | string;
|
|
|
250
268
|
* Usage:
|
|
251
269
|
*
|
|
252
270
|
* ```javascript
|
|
271
|
+
* import { getScriptQueryParam } from "mazey";
|
|
272
|
+
*
|
|
253
273
|
* const ret = getScriptQueryParam("test", "https://example.com/example.js");
|
|
254
274
|
* console.log(ret);
|
|
255
275
|
* ```
|
|
@@ -273,6 +293,8 @@ export declare function getScriptQueryParam(param: string, matchString?: string)
|
|
|
273
293
|
* Usage:
|
|
274
294
|
*
|
|
275
295
|
* ```javascript
|
|
296
|
+
* import { convertObjectToQuery } from "mazey";
|
|
297
|
+
*
|
|
276
298
|
* const ret = convertObjectToQuery({ t1: "1", t2: "2", t3: "3", t4: "4" });
|
|
277
299
|
* console.log(ret);
|
|
278
300
|
* ```
|
|
@@ -296,6 +318,8 @@ export declare function convertObjectToQuery(obj: {
|
|
|
296
318
|
* Usage:
|
|
297
319
|
*
|
|
298
320
|
* ```javascript
|
|
321
|
+
* import { convertHttpToHttps } from "mazey";
|
|
322
|
+
*
|
|
299
323
|
* const ret = convertHttpToHttps("http://example.com");
|
|
300
324
|
* console.log(ret);
|
|
301
325
|
* ```
|
package/lib/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAW,GAAG,oBAAoB,CAYxE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CA0BzH;AAED;;;;;;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;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU9C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU9C"}
|
package/lib/util.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { ThrottleFunc, DebounceFunc, IsNumberOptions, ZResResponse, ZResIsV
|
|
|
5
5
|
* Usage:
|
|
6
6
|
*
|
|
7
7
|
* ```javascript
|
|
8
|
+
* import { deepCopy } from "mazey";
|
|
9
|
+
*
|
|
8
10
|
* const ret1 = deepCopy(["a", "b", "c"]);
|
|
9
11
|
* const ret2 = deepCopy("abc");
|
|
10
12
|
* console.log(ret1);
|
|
@@ -30,11 +32,13 @@ export declare function deepCopy<T>(obj: T): T;
|
|
|
30
32
|
*/
|
|
31
33
|
export declare function deepCopyObject<T>(obj: T): T;
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Convert CamelCase to KebabCase.
|
|
34
36
|
*
|
|
35
37
|
* Usage:
|
|
36
38
|
*
|
|
37
39
|
* ```javascript
|
|
40
|
+
* import { convertCamelToKebab } from "mazey";
|
|
41
|
+
*
|
|
38
42
|
* const ret1 = convertCamelToKebab("ABC");
|
|
39
43
|
* const ret2 = convertCamelToKebab("aBC");
|
|
40
44
|
* console.log(ret1);
|
|
@@ -59,6 +63,8 @@ export declare function convertCamelToKebab(camelCase: string): string;
|
|
|
59
63
|
* Usage:
|
|
60
64
|
*
|
|
61
65
|
* ```javascript
|
|
66
|
+
* import { convertKebabToCamel } from "mazey";
|
|
67
|
+
*
|
|
62
68
|
* const ret1 = convertKebabToCamel("a-b-c");
|
|
63
69
|
* const ret2 = convertKebabToCamel("a-bb-cc");
|
|
64
70
|
* console.log(ret1, ret2);
|
|
@@ -82,11 +88,13 @@ export declare function convertKebabToCamel(kebabCase: string): string;
|
|
|
82
88
|
*/
|
|
83
89
|
export declare function camelCaseToKebabCase(camelCase: string): string;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
91
|
+
* Convert CamelCase to Underscore.
|
|
86
92
|
*
|
|
87
93
|
* Usage:
|
|
88
94
|
*
|
|
89
95
|
* ```javascript
|
|
96
|
+
* import { convertCamelToUnder } from "mazey";
|
|
97
|
+
*
|
|
90
98
|
* const ret1 = convertCamelToUnder("ABC");
|
|
91
99
|
* const ret2 = convertCamelToUnder("aBC");
|
|
92
100
|
* console.log(ret1);
|
|
@@ -111,6 +119,8 @@ export declare function convertCamelToUnder(camelCase: string): string;
|
|
|
111
119
|
* Usage:
|
|
112
120
|
*
|
|
113
121
|
* ```javascript
|
|
122
|
+
* import { convertUnderToCamel } from "mazey";
|
|
123
|
+
*
|
|
114
124
|
* const ret1 = convertUnderToCamel("a_b_c");
|
|
115
125
|
* const ret2 = convertUnderToCamel("a_bb_cc");
|
|
116
126
|
* console.log(ret1, ret2);
|
|
@@ -141,6 +151,8 @@ export declare function camelCase2Underscore(camelCase: string): string;
|
|
|
141
151
|
* Usage:
|
|
142
152
|
*
|
|
143
153
|
* ```javascript
|
|
154
|
+
* import { mTrim } from "mazey";
|
|
155
|
+
*
|
|
144
156
|
* const ret1 = mTrim(" 1 2 3 ");
|
|
145
157
|
* const ret2 = mTrim("abc ");
|
|
146
158
|
* console.log(ret1);
|
|
@@ -166,6 +178,8 @@ export declare function mTrim(str: string): string;
|
|
|
166
178
|
* Usage:
|
|
167
179
|
*
|
|
168
180
|
* ```javascript
|
|
181
|
+
* import { isJSONString } from "mazey";
|
|
182
|
+
*
|
|
169
183
|
* const ret1 = isJSONString(`['a', 'b', 'c']`);
|
|
170
184
|
* const ret2 = isJSONString(`["a", "b", "c"]`);
|
|
171
185
|
* console.log(ret1);
|
|
@@ -191,11 +205,13 @@ export declare function isJSONString(str: string): boolean;
|
|
|
191
205
|
*/
|
|
192
206
|
export declare function isJsonString(str: string): boolean;
|
|
193
207
|
/**
|
|
194
|
-
*
|
|
208
|
+
* Generate a random string of number, `genRndNumString(7)` => "7658495".
|
|
195
209
|
*
|
|
196
210
|
* Usage:
|
|
197
211
|
*
|
|
198
212
|
* ```javascript
|
|
213
|
+
* import { genRndNumString } from "mazey";
|
|
214
|
+
*
|
|
199
215
|
* const ret1 = genRndNumString(4);
|
|
200
216
|
* const ret2 = genRndNumString(7);
|
|
201
217
|
* console.log(ret1);
|
|
@@ -228,6 +244,8 @@ export declare function generateRndNum(n?: number): string;
|
|
|
228
244
|
* Usage:
|
|
229
245
|
*
|
|
230
246
|
* ```javascript
|
|
247
|
+
* import { genUniqueNumString } from "mazey";
|
|
248
|
+
*
|
|
231
249
|
* const ret1 = genUniqueNumString();
|
|
232
250
|
* const ret2 = genUniqueNumString(3);
|
|
233
251
|
* console.log(ret1);
|
|
@@ -259,6 +277,8 @@ export declare function generateUniqueNum(n?: number): string;
|
|
|
259
277
|
* Usage:
|
|
260
278
|
*
|
|
261
279
|
* ```javascript
|
|
280
|
+
* import { mNow } from "mazey";
|
|
281
|
+
*
|
|
262
282
|
* const ret = mNow();
|
|
263
283
|
* console.log(ret);
|
|
264
284
|
* ```
|
|
@@ -280,6 +300,8 @@ export declare function mNow(): number;
|
|
|
280
300
|
* Usage:
|
|
281
301
|
*
|
|
282
302
|
* ```javascript
|
|
303
|
+
* import { floatToPercent } from "mazey";
|
|
304
|
+
*
|
|
283
305
|
* const ret1 = floatToPercent(0.2);
|
|
284
306
|
* const ret2 = floatToPercent(0.2, 2);
|
|
285
307
|
* console.log(ret1);
|
|
@@ -306,6 +328,8 @@ export declare function floatToPercent(num: number, fixSize?: number): string;
|
|
|
306
328
|
* Usage:
|
|
307
329
|
*
|
|
308
330
|
* ```javascript
|
|
331
|
+
* import { floatFixed } from "mazey";
|
|
332
|
+
*
|
|
309
333
|
* const ret1 = floatFixed(0.2);
|
|
310
334
|
* const ret2 = floatFixed(0.2, 2);
|
|
311
335
|
* console.log(ret1);
|
|
@@ -330,6 +354,8 @@ export declare function floatFixed(num: string, size?: number): string;
|
|
|
330
354
|
* Usage:
|
|
331
355
|
*
|
|
332
356
|
* ```javascript
|
|
357
|
+
* import { throttle } from "mazey";
|
|
358
|
+
*
|
|
333
359
|
* const foo = throttle(() => {
|
|
334
360
|
* console.log("The function will be invoked at most once per every wait 1000 milliseconds.");
|
|
335
361
|
* }, 1000, { leading: true });
|
|
@@ -351,6 +377,8 @@ export declare function throttle<T extends (...args: MazeyFnParams) => MazeyFnRe
|
|
|
351
377
|
* Usage:
|
|
352
378
|
*
|
|
353
379
|
* ```javascript
|
|
380
|
+
* import { debounce } from "mazey";
|
|
381
|
+
*
|
|
354
382
|
* const foo = debounce(() => {
|
|
355
383
|
* console.log("The debounced function will only be invoked in 1000 milliseconds, the other invoking will disappear during the wait time.");
|
|
356
384
|
* }, 1000, true);
|
|
@@ -367,6 +395,8 @@ export declare function debounce<T extends (...args: MazeyFnParams) => MazeyFnRe
|
|
|
367
395
|
* Usage:
|
|
368
396
|
*
|
|
369
397
|
* ```javascript
|
|
398
|
+
* import { getFriendlyInterval } from "mazey";
|
|
399
|
+
*
|
|
370
400
|
* const ret1 = getFriendlyInterval(new Date("2020-03-28 00:09:27"), new Date("2023-04-18 10:54:00"), { type: "d" });
|
|
371
401
|
* const ret2 = getFriendlyInterval(1585325367000, 1681786440000, { type: "text" });
|
|
372
402
|
* const ret3 = getFriendlyInterval("2020-03-28 00:09:27", "2023-04-18 10:54:00", { type: "text" });
|
|
@@ -400,6 +430,8 @@ export declare function getFriendlyInterval(start?: number | string | Date, end?
|
|
|
400
430
|
* Usage:
|
|
401
431
|
*
|
|
402
432
|
* ```javascript
|
|
433
|
+
* import { isNumber } from "mazey";
|
|
434
|
+
*
|
|
403
435
|
* const ret1 = isNumber(123);
|
|
404
436
|
* const ret2 = isNumber("123");
|
|
405
437
|
* // Default: NaN, Infinity is not Number
|
|
@@ -431,6 +463,8 @@ export declare function isNumber(num: unknown, options?: IsNumberOptions): boole
|
|
|
431
463
|
* Usage:
|
|
432
464
|
*
|
|
433
465
|
* ```javascript
|
|
466
|
+
* import { invokeFn } from "mazey";
|
|
467
|
+
*
|
|
434
468
|
* const ret = invokeFn(() => {
|
|
435
469
|
* console.log("invokeFn");
|
|
436
470
|
* });
|
|
@@ -452,6 +486,8 @@ export declare function doFn(fn: MazeyFunction, ...params: Parameters<MazeyFunct
|
|
|
452
486
|
* Usage:
|
|
453
487
|
*
|
|
454
488
|
* ```javascript
|
|
489
|
+
* import { isNonEmptyArray } from "mazey";
|
|
490
|
+
*
|
|
455
491
|
* const ret = isNonEmptyArray([1, 2, 3]);
|
|
456
492
|
* console.log(ret);
|
|
457
493
|
* ```
|
|
@@ -654,6 +690,8 @@ export declare function isNonEmptyObject(obj: MazeyObject): boolean;
|
|
|
654
690
|
* Usage:
|
|
655
691
|
*
|
|
656
692
|
* ```javascript
|
|
693
|
+
* import { convertToHtmlBreaks } from "mazey";
|
|
694
|
+
*
|
|
657
695
|
* const ret1 = convertToHtmlBreaks("a\nb\nc");
|
|
658
696
|
* const ret2 = convertToHtmlBreaks("a\n\nbc");
|
|
659
697
|
* console.log(ret1);
|
|
@@ -684,6 +722,8 @@ export declare function newLine(str: string): string;
|
|
|
684
722
|
* Usage:
|
|
685
723
|
*
|
|
686
724
|
* ```javascript
|
|
725
|
+
* import { removeHTML } from "mazey";
|
|
726
|
+
*
|
|
687
727
|
* const ret = removeHTML("<div>hello world</div>");
|
|
688
728
|
* console.log(ret);
|
|
689
729
|
* ```
|
|
@@ -731,6 +771,8 @@ export declare function clearHtml(str: string, options?: {
|
|
|
731
771
|
* Usage:
|
|
732
772
|
*
|
|
733
773
|
* ```javascript
|
|
774
|
+
* import { sanitizeInput } from "mazey";
|
|
775
|
+
*
|
|
734
776
|
* const ret = sanitizeInput("<div>hello world</div>");
|
|
735
777
|
* console.log(ret);
|
|
736
778
|
* ```
|
|
@@ -752,6 +794,8 @@ export declare function sanitizeInput(input: string): string;
|
|
|
752
794
|
* Usage:
|
|
753
795
|
*
|
|
754
796
|
* ```javascript
|
|
797
|
+
* import { unsanitizeInput } from "mazey";
|
|
798
|
+
*
|
|
755
799
|
* const ret = unsanitizeInput("<div>hello world</div>");
|
|
756
800
|
* console.log(ret);
|
|
757
801
|
* ```
|
|
@@ -781,6 +825,8 @@ export declare function unsanitize(str: string): string;
|
|
|
781
825
|
* Usage:
|
|
782
826
|
*
|
|
783
827
|
* ```javascript
|
|
828
|
+
* import { cutZHString } from "mazey";
|
|
829
|
+
*
|
|
784
830
|
* const ret = cutZHString("hello world", 5);
|
|
785
831
|
* console.log(ret);
|
|
786
832
|
* ```
|
|
@@ -808,6 +854,8 @@ export declare function cutZHString(str: string, len: number, options?: {
|
|
|
808
854
|
* Usage:
|
|
809
855
|
*
|
|
810
856
|
* ```javascript
|
|
857
|
+
* import { truncateZHString } from "mazey";
|
|
858
|
+
*
|
|
811
859
|
* const ret = truncateZHString("hello world", 5);
|
|
812
860
|
* console.log(ret);
|
|
813
861
|
* ```
|
|
@@ -845,6 +893,8 @@ export declare function zAxiosIsValidRes(res: ZResResponse | undefined, options?
|
|
|
845
893
|
* Usage:
|
|
846
894
|
*
|
|
847
895
|
* ```javascript
|
|
896
|
+
* import { isValidData } from "mazey";
|
|
897
|
+
*
|
|
848
898
|
* const validData = {
|
|
849
899
|
* a: {
|
|
850
900
|
* b: {
|
|
@@ -883,6 +933,8 @@ export declare function isValidData(data: MazeyObject, attributes: string[], val
|
|
|
883
933
|
* Usage:
|
|
884
934
|
*
|
|
885
935
|
* ```javascript
|
|
936
|
+
* import { getFileSize } from "mazey";
|
|
937
|
+
*
|
|
886
938
|
* const ret = getFileSize(1024);
|
|
887
939
|
* console.log(ret);
|
|
888
940
|
* ```
|
|
@@ -902,6 +954,8 @@ export declare function getFileSize(size: number): string;
|
|
|
902
954
|
* Usage:
|
|
903
955
|
*
|
|
904
956
|
* ```javascript
|
|
957
|
+
* import { genHashCode } from "mazey";
|
|
958
|
+
*
|
|
905
959
|
* const ret = genHashCode("hello world");
|
|
906
960
|
* console.log(ret);
|
|
907
961
|
* ```
|
|
@@ -923,6 +977,8 @@ export declare function genHashCode(str: string): number;
|
|
|
923
977
|
* Usage:
|
|
924
978
|
*
|
|
925
979
|
* ```javascript
|
|
980
|
+
* import { formatDate } from "mazey";
|
|
981
|
+
*
|
|
926
982
|
* const ret1 = formatDate();
|
|
927
983
|
* const ret2 = formatDate("Tue Jan 11 2022 14:12:26 GMT+0800 (China Standard Time)", "yyyy-MM-dd hh:mm:ss a");
|
|
928
984
|
* const ret3 = formatDate(1641881235000, "yyyy-MM-dd hh:mm:ss a");
|
|
@@ -954,6 +1010,8 @@ export declare function formatDate(dateIns?: MazeyDate, format?: string): string
|
|
|
954
1010
|
* Usage:
|
|
955
1011
|
*
|
|
956
1012
|
* ```javascript
|
|
1013
|
+
* import { isMobile } from "mazey";
|
|
1014
|
+
*
|
|
957
1015
|
* const ret1 = isMobile("13800138000");
|
|
958
1016
|
* const ret2 = isMobile("1380013800");
|
|
959
1017
|
* const ret3 = isMobile("138001380000");
|
|
@@ -978,6 +1036,8 @@ export declare function isValidPhoneNumber(mobile: string): boolean;
|
|
|
978
1036
|
* Usage:
|
|
979
1037
|
*
|
|
980
1038
|
* ```javascript
|
|
1039
|
+
* import { isValidEmail } from "mazey";
|
|
1040
|
+
*
|
|
981
1041
|
* const ret = isValidEmail("mazeyqian@gmail.com");
|
|
982
1042
|
* console.log(ret);
|
|
983
1043
|
* ```
|
|
@@ -999,6 +1059,8 @@ export declare function isValidEmail(email: string): boolean;
|
|
|
999
1059
|
* Usage:
|
|
1000
1060
|
*
|
|
1001
1061
|
* ```javascript
|
|
1062
|
+
* import { convert10To26 } from "mazey";
|
|
1063
|
+
*
|
|
1002
1064
|
* const ret1 = convert10To26(1);
|
|
1003
1065
|
* const ret2 = convert10To26(26);
|
|
1004
1066
|
* const ret3 = convert10To26(27);
|
|
@@ -1030,6 +1092,8 @@ export declare function getCurrentVersion(): string;
|
|
|
1030
1092
|
* Usage:
|
|
1031
1093
|
*
|
|
1032
1094
|
* ```javascript
|
|
1095
|
+
* import { repeatUntilConditionMet } from "mazey";
|
|
1096
|
+
*
|
|
1033
1097
|
* repeatUntilConditionMet(
|
|
1034
1098
|
* () => {
|
|
1035
1099
|
* console.log("repeatUntilConditionMet");
|
|
@@ -1061,6 +1125,8 @@ export declare function repeatUntilConditionMet<T extends (...args: MazeyFnParam
|
|
|
1061
1125
|
* Usage:
|
|
1062
1126
|
*
|
|
1063
1127
|
* ```javascript
|
|
1128
|
+
* import { waitTime } from "mazey";
|
|
1129
|
+
*
|
|
1064
1130
|
* waitTime(1000).then((time) => {
|
|
1065
1131
|
* console.log("waitTime:", time);
|
|
1066
1132
|
* });
|
|
@@ -1089,6 +1155,8 @@ export declare function sleep(time: number): Promise<number>;
|
|
|
1089
1155
|
* Usage:
|
|
1090
1156
|
*
|
|
1091
1157
|
* ```javascript
|
|
1158
|
+
* import { isBrowser } from "mazey";
|
|
1159
|
+
*
|
|
1092
1160
|
* const ret = isBrowser();
|
|
1093
1161
|
* console.log(ret);
|
|
1094
1162
|
* ```
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,YAAY,EAAE,eAAe,EAC3C,YAAY,EAAE,qBAAqB,EACrB,UAAU,EAAE,SAAS,EACnC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EACxD,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,YAAY,EAAE,eAAe,EAC3C,YAAY,EAAE,qBAAqB,EACrB,UAAU,EAAE,SAAS,EACnC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EACxD,kBAAkB,EACnB,MAAM,U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