amos-tool 1.6.6 → 1.6.8
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/docs/Logger.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- package/index.d.ts +10 -0
- package/lib/_uuids.js +29 -22
- package/lib/utils.js +2 -0
- package/package.json +1 -1
package/docs/Logger.html
CHANGED
|
@@ -490,7 +490,7 @@ isDebug: true
|
|
|
490
490
|
<br class="clear">
|
|
491
491
|
|
|
492
492
|
<footer>
|
|
493
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
493
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Mar 19 2024 13:53:53 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
494
494
|
</footer>
|
|
495
495
|
|
|
496
496
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -16802,7 +16802,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
|
|
|
16802
16802
|
<br class="clear">
|
|
16803
16803
|
|
|
16804
16804
|
<footer>
|
|
16805
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
16805
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Mar 19 2024 13:53:53 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
16806
16806
|
</footer>
|
|
16807
16807
|
|
|
16808
16808
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -793,7 +793,7 @@ convert2BMP(canvas, width, height)</p>
|
|
|
793
793
|
<br class="clear">
|
|
794
794
|
|
|
795
795
|
<footer>
|
|
796
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
796
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Mar 19 2024 13:53:53 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
797
797
|
</footer>
|
|
798
798
|
|
|
799
799
|
<script>prettyPrint();</script>
|
package/index.d.ts
CHANGED
|
@@ -147,6 +147,14 @@ declare namespace UUID {
|
|
|
147
147
|
* UUID.uuidCompact(); // 090c3e83-ea67-45c4-b7dc-47c20eaea91e
|
|
148
148
|
*/
|
|
149
149
|
export function uuidCompact(): string;
|
|
150
|
+
/**
|
|
151
|
+
* 获取 uid,以 Date.now() 为随机参照值
|
|
152
|
+
* @param flag 是否显示短杠,为 true 则去掉单杠
|
|
153
|
+
* @example
|
|
154
|
+
* UUID.uuidTime(); // 6fcac0c8-e7de-44e4-ada7-c1de03a45ad5
|
|
155
|
+
* UUID.uuidTime(true); // 5eb47f42a03c48e6ae6804a2517a1db4
|
|
156
|
+
*/
|
|
157
|
+
export function uuidTime(flag: boolean): string;
|
|
150
158
|
/**
|
|
151
159
|
* @param prefix
|
|
152
160
|
* @example
|
|
@@ -284,6 +292,8 @@ declare namespace LocationParam {
|
|
|
284
292
|
* changeParam('a/b/d/g', { a: 1, b: null, c: undefined }); // 'a/b/d/g?a=1&b=null&c='
|
|
285
293
|
* // [] 和 {} 值。最好不要给参数中传入 {} 值
|
|
286
294
|
* changeParam('a/b/d/g', { a: { m: 3 }, b: [1,2] }); // a/b/d/g?a={"m":3}&b=1,2
|
|
295
|
+
* // 更换 token={token} 值,注意 原理并不是替换 {token} 值,而是更新 `token=xxx` 值,也就是目标是 `=` 左边的 `key` 与 params 中的 key 匹配
|
|
296
|
+
* changeParam('a/b/d/g?token={token}', { a: 'file', b: [1,2], token: 'mytoken' }); // a/b/d/g?token=mytoken&a=file&b=1,2
|
|
287
297
|
*/
|
|
288
298
|
export function changeParam(href: String, params: Object): String;
|
|
289
299
|
/**
|
package/lib/_uuids.js
CHANGED
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),
|
|
4
|
-
var x = "yyyyMMddhhmm",
|
|
5
|
-
"M+":
|
|
6
|
-
"d+":
|
|
7
|
-
"h+":
|
|
8
|
-
"m+":
|
|
9
|
-
"s+":
|
|
10
|
-
S:
|
|
3
|
+
var CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), index = 0, longtimeIndex = 0, formatDate = function() {
|
|
4
|
+
var x = "yyyyMMddhhmm", t = new Date, e = {
|
|
5
|
+
"M+": t.getMonth() + 1,
|
|
6
|
+
"d+": t.getDate(),
|
|
7
|
+
"h+": t.getHours(),
|
|
8
|
+
"m+": t.getMinutes(),
|
|
9
|
+
"s+": t.getSeconds(),
|
|
10
|
+
S: t.getMilliseconds()
|
|
11
11
|
};
|
|
12
|
-
for (var n in /(y+)/.test(x) && (x = x.replace(RegExp.$1, (
|
|
13
|
-
|
|
12
|
+
for (var n in /(y+)/.test(x) && (x = x.replace(RegExp.$1, (t.getFullYear() + "").substr(4 - RegExp.$1.length))),
|
|
13
|
+
e) new RegExp("(" + n + ")").test(x) && (x = x.replace(RegExp.$1, 1 == RegExp.$1.length ? e[n] : ("00" + e[n]).substr(("" + e[n]).length)));
|
|
14
14
|
return x;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
module.exports = {
|
|
18
|
-
uuid: function(x,
|
|
19
|
-
var
|
|
20
|
-
if (
|
|
21
|
-
o[14] = "4",
|
|
18
|
+
uuid: function(x, t) {
|
|
19
|
+
var e, n, r = CHARS, o = [];
|
|
20
|
+
if (t = t || r.length, x) for (e = 0; e < x; e++) o[e] = r[0 | Math.random() * t]; else for (o[8] = o[13] = o[18] = o[23] = "-",
|
|
21
|
+
o[14] = "4", e = 0; e < 36; e++) o[e] || (n = 0 | 16 * Math.random(), o[e] = r[19 == e ? 3 & n | 8 : n]);
|
|
22
22
|
return o.join("");
|
|
23
23
|
},
|
|
24
24
|
uuidFast: function() {
|
|
25
|
-
for (var x,
|
|
26
|
-
x = 15 & n, n >>= 4,
|
|
27
|
-
return
|
|
25
|
+
for (var x, t = CHARS, e = new Array(36), n = 0, r = 0; r < 36; r++) 8 == r || 13 == r || 18 == r || 23 == r ? e[r] = "-" : 14 == r ? e[r] = "4" : (n <= 2 && (n = 33554432 + 16777216 * Math.random() | 0),
|
|
26
|
+
x = 15 & n, n >>= 4, e[r] = t[19 == r ? 3 & x | 8 : x]);
|
|
27
|
+
return e.join("");
|
|
28
28
|
},
|
|
29
29
|
uuidCompact: function() {
|
|
30
30
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(x) {
|
|
31
|
-
var
|
|
32
|
-
return ("x" == x ?
|
|
31
|
+
var t = 16 * Math.random() | 0;
|
|
32
|
+
return ("x" == x ? t : 3 & t | 8).toString(16);
|
|
33
33
|
}));
|
|
34
34
|
},
|
|
35
|
+
uuidTime: function(x) {
|
|
36
|
+
var t = Date.now(), e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(x) {
|
|
37
|
+
var e = (t + 16 * Math.random()) % 16 | 0;
|
|
38
|
+
return t = Math.floor(t / 16), ("x" === x ? e : 3 & e | 8).toString(16);
|
|
39
|
+
}));
|
|
40
|
+
return x ? e.replace(/-/g, "") : e;
|
|
41
|
+
},
|
|
35
42
|
timeUUID: function(x) {
|
|
36
|
-
return x || (x = "amos-timeuuid"), x + "-" + now + "-" + ++index;
|
|
43
|
+
return x || (x = "amos-timeuuid"), x + "-" + Date.now() + "-" + ++index;
|
|
37
44
|
},
|
|
38
45
|
longTimeUUID: function(x) {
|
|
39
46
|
return x || (x = "longtime"), x + "-" + formatDate() + "-" + ++longtimeIndex;
|
|
40
47
|
},
|
|
41
48
|
otherUUID: function(x) {
|
|
42
49
|
return (x = x || "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx").replace(/[xy]/g, (function(x) {
|
|
43
|
-
var
|
|
44
|
-
return ("x" == x ?
|
|
50
|
+
var t = 16 * Math.random() | 0;
|
|
51
|
+
return ("x" == x ? t : 3 & t | 8).toString(16);
|
|
45
52
|
})).replace(/\-/g, "");
|
|
46
53
|
}
|
|
47
54
|
};
|
package/lib/utils.js
CHANGED
|
@@ -8,6 +8,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
8
8
|
var t = getLength(e);
|
|
9
9
|
return "number" == typeof t && t >= 0 && t <= MAX_ARRAY_INDEX;
|
|
10
10
|
}, isNumber = function(e) {
|
|
11
|
+
if (isArray(e)) return !1;
|
|
12
|
+
if (isObject(e)) return !1;
|
|
11
13
|
var t = /^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(e), n = "number" == typeof e && !isNaN(e);
|
|
12
14
|
return t || n;
|
|
13
15
|
}, isFloat = function(e) {
|