amos-tool 1.5.3 → 1.6.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 +3 -0
- package/docs/Logger.html +1 -1
- package/docs/global.html +16 -4
- package/docs/index.html +5 -1
- package/index.d.ts +5 -2
- package/lib/dom/fileSaveAs.js +79 -57
- package/lib/utils.js +2 -0
- package/package.json +3 -2
package/README.md
CHANGED
package/docs/Logger.html
CHANGED
|
@@ -336,7 +336,7 @@ isDebug: true
|
|
|
336
336
|
<br class="clear">
|
|
337
337
|
|
|
338
338
|
<footer>
|
|
339
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
339
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Fri Aug 11 2023 16:41:39 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
340
340
|
</footer>
|
|
341
341
|
|
|
342
342
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -8892,7 +8892,7 @@ Object 对象,typeof === object && toString === '[object Object]'</p>
|
|
|
8892
8892
|
|
|
8893
8893
|
|
|
8894
8894
|
|
|
8895
|
-
<td class="description last"></td>
|
|
8895
|
+
<td class="description last"><p>如果 obj 是 null or undefined 则直接 返回 false</p></td>
|
|
8896
8896
|
</tr>
|
|
8897
8897
|
|
|
8898
8898
|
|
|
@@ -10030,7 +10030,7 @@ isNil(NaN)
|
|
|
10030
10030
|
|
|
10031
10031
|
|
|
10032
10032
|
|
|
10033
|
-
<td class="description last"></td>
|
|
10033
|
+
<td class="description last"><p>如果 obj 是 null or undefined 则直接 返回 false</p></td>
|
|
10034
10034
|
</tr>
|
|
10035
10035
|
|
|
10036
10036
|
|
|
@@ -14217,7 +14217,7 @@ clear 是否清理前一次的事件,如果清理,则重新设置定时器</
|
|
|
14217
14217
|
|
|
14218
14218
|
|
|
14219
14219
|
|
|
14220
|
-
<h4 class="name" id="slpitArray"><span class="type-signature"></span>slpitArray<span class="signature">(arr, num)</span><span class="type-signature"
|
|
14220
|
+
<h4 class="name" id="slpitArray"><span class="type-signature"></span>slpitArray<span class="signature">(arr, num)</span><span class="type-signature"> → {Array}</span></h4>
|
|
14221
14221
|
|
|
14222
14222
|
|
|
14223
14223
|
|
|
@@ -14374,6 +14374,18 @@ clear 是否清理前一次的事件,如果清理,则重新设置定时器</
|
|
|
14374
14374
|
|
|
14375
14375
|
|
|
14376
14376
|
|
|
14377
|
+
<dl class="param-type">
|
|
14378
|
+
<dt>
|
|
14379
|
+
Type
|
|
14380
|
+
</dt>
|
|
14381
|
+
<dd>
|
|
14382
|
+
|
|
14383
|
+
<span class="param-type">Array</span>
|
|
14384
|
+
|
|
14385
|
+
|
|
14386
|
+
</dd>
|
|
14387
|
+
</dl>
|
|
14388
|
+
|
|
14377
14389
|
|
|
14378
14390
|
|
|
14379
14391
|
|
|
@@ -16595,7 +16607,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
|
|
|
16595
16607
|
<br class="clear">
|
|
16596
16608
|
|
|
16597
16609
|
<footer>
|
|
16598
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
16610
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Fri Aug 11 2023 16:41:39 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
16599
16611
|
</footer>
|
|
16600
16612
|
|
|
16601
16613
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -743,6 +743,10 @@ convert2BMP(canvas, width, height)</p>
|
|
|
743
743
|
<h2>changelog</h2>
|
|
744
744
|
<ul>
|
|
745
745
|
<li>
|
|
746
|
+
<p>v1.6.1
|
|
747
|
+
<code>*</code> fix saver</p>
|
|
748
|
+
</li>
|
|
749
|
+
<li>
|
|
746
750
|
<p>v1.4.1
|
|
747
751
|
<code>*</code> add <code>pathToRoutes</code></p>
|
|
748
752
|
</li>
|
|
@@ -785,7 +789,7 @@ convert2BMP(canvas, width, height)</p>
|
|
|
785
789
|
<br class="clear">
|
|
786
790
|
|
|
787
791
|
<footer>
|
|
788
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
792
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Fri Aug 11 2023 16:41:39 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
789
793
|
</footer>
|
|
790
794
|
|
|
791
795
|
<script>prettyPrint();</script>
|
package/index.d.ts
CHANGED
|
@@ -685,6 +685,7 @@ export function omit(obj: object, keys: string | Array<String>): any;
|
|
|
685
685
|
* @example
|
|
686
686
|
* pick({ name: 'ilex', age: 16 }, ['age']); // { age: 16 }
|
|
687
687
|
* pick({ name: 'ilex', age: 16 }, ['']); // {}
|
|
688
|
+
* pick({ name: 'ilex', age: 16 }, ['you']); // {},如果指定对象中无指定的 key,则不拾取
|
|
688
689
|
*/
|
|
689
690
|
export function pick(obj: Object | Function, keys: string | Array<String>): Object;
|
|
690
691
|
/**
|
|
@@ -1032,6 +1033,8 @@ declare namespace utils {
|
|
|
1032
1033
|
* isUrl('www.baidu.com') // false
|
|
1033
1034
|
* isUrl('http://172.16.1.2') // true
|
|
1034
1035
|
* isUrl('172.16.1.2') // false
|
|
1036
|
+
* isUrl('/a/b/c') // false
|
|
1037
|
+
* isUrl('main/dd/d') // false
|
|
1035
1038
|
*/
|
|
1036
1039
|
export function isUrl(value: string): boolean;
|
|
1037
1040
|
export function isBuiltInObject(value: any): boolean;
|
|
@@ -1059,14 +1062,14 @@ declare namespace utils {
|
|
|
1059
1062
|
* 判断key是否在object内
|
|
1060
1063
|
* (采用 in 判断,继承属性均会判断)
|
|
1061
1064
|
* @param keys
|
|
1062
|
-
* @param obj
|
|
1065
|
+
* @param obj 如果 obj 是 null or undefined, 或者 非 object,则直接 返回 false
|
|
1063
1066
|
*/
|
|
1064
1067
|
export function isKeyInObject(keys: string | string[], obj: any): boolean;
|
|
1065
1068
|
/**
|
|
1066
1069
|
* 判断key是否在object内
|
|
1067
1070
|
* (采用 hasOwnProperty 判断,继承属性不会判断)
|
|
1068
1071
|
* @param keys
|
|
1069
|
-
* @param obj
|
|
1072
|
+
* @param obj 如果 obj 是 null or undefined, 或者 非 object,则直接 返回 false
|
|
1070
1073
|
*/
|
|
1071
1074
|
export function isOwnKeyInObject(keys: string | string[], obj: any): boolean;
|
|
1072
1075
|
/**
|
package/lib/dom/fileSaveAs.js
CHANGED
|
@@ -1,61 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), _global = "object" === ("undefined" == typeof window ? "undefined" : (0,
|
|
4
|
+
_typeof2.default)(window)) && window.window === window ? window : "object" === ("undefined" == typeof self ? "undefined" : (0,
|
|
5
|
+
_typeof2.default)(self)) && self.self === self ? self : "object" === ("undefined" == typeof global ? "undefined" : (0,
|
|
6
|
+
_typeof2.default)(global)) && global.global === global ? global : void 0;
|
|
7
|
+
|
|
8
|
+
function bom(e, t) {
|
|
9
|
+
return void 0 === t ? t = {
|
|
10
|
+
autoBom: !1
|
|
11
|
+
} : "object" !== (0, _typeof2.default)(t) && (console.warn("Deprecated: Expected third argument to be a object"),
|
|
12
|
+
t = {
|
|
13
|
+
autoBom: !t
|
|
14
|
+
}), t.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob([ String.fromCharCode(65279), e ], {
|
|
15
|
+
type: e.type
|
|
16
|
+
}) : e;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function download(e, t, o) {
|
|
20
|
+
var n = new XMLHttpRequest;
|
|
21
|
+
n.open("GET", e), n.responseType = "blob", n.onload = function() {
|
|
22
|
+
saveAs(n.response, t, o);
|
|
23
|
+
}, n.onerror = function() {
|
|
24
|
+
console.error("could not download file");
|
|
25
|
+
}, n.send();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function corsEnabled(e) {
|
|
29
|
+
var t = new XMLHttpRequest;
|
|
30
|
+
t.open("HEAD", e, !1);
|
|
31
|
+
try {
|
|
32
|
+
t.send();
|
|
33
|
+
} catch (e) {}
|
|
34
|
+
return t.status >= 200 && t.status <= 299;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function click(e) {
|
|
38
|
+
try {
|
|
39
|
+
e.dispatchEvent(new MouseEvent("click"));
|
|
40
|
+
} catch (o) {
|
|
41
|
+
var t = document.createEvent("MouseEvents");
|
|
42
|
+
t.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null),
|
|
43
|
+
e.dispatchEvent(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), saveAs = "object" !== ("undefined" == typeof window ? "undefined" : (0,
|
|
48
|
+
_typeof2.default)(window)) || window !== _global ? function() {} : "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? function(e, t, o) {
|
|
49
|
+
var n = _global.URL || _global.webkitURL, a = document.createElement("a");
|
|
50
|
+
t = t || e.name || "download", a.download = t, a.rel = "noopener", "string" == typeof e ? (a.href = e,
|
|
51
|
+
a.origin !== location.origin ? corsEnabled(a.href) ? download(e, t, o) : click(a, a.target = "_blank") : click(a)) : (a.href = n.createObjectURL(e),
|
|
52
|
+
setTimeout((function() {
|
|
53
|
+
n.revokeObjectURL(a.href);
|
|
54
|
+
}), 4e4), setTimeout((function() {
|
|
55
|
+
click(a);
|
|
56
|
+
}), 0));
|
|
57
|
+
} : "msSaveOrOpenBlob" in navigator ? function(e, t, o) {
|
|
58
|
+
if (t = t || e.name || "download", "string" == typeof e) if (corsEnabled(e)) download(e, t, o); else {
|
|
59
|
+
var n = document.createElement("a");
|
|
60
|
+
n.href = e, n.target = "_blank", setTimeout((function() {
|
|
61
|
+
click(n);
|
|
62
|
+
}));
|
|
63
|
+
} else navigator.msSaveOrOpenBlob(bom(e, o), t);
|
|
64
|
+
} : function(e, t, o, n) {
|
|
65
|
+
if ((n = n || open("", "_blank")) && (n.document.title = n.document.body.innerText = "downloading..."),
|
|
66
|
+
"string" == typeof e) return download(e, t, o);
|
|
67
|
+
var a = "application/octet-stream" === e.type, i = /constructor/i.test(_global.HTMLElement) || _global.safari, l = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
68
|
+
if ((l || a && i || isMacOSWebView) && "undefined" != typeof FileReader) {
|
|
69
|
+
var r = new FileReader;
|
|
70
|
+
r.onloadend = function() {
|
|
71
|
+
var e = r.result;
|
|
72
|
+
e = l ? e : e.replace(/^data:[^;]*;/, "data:attachment/file;"), n ? n.location.href = e : location = e,
|
|
73
|
+
n = null;
|
|
74
|
+
}, r.readAsDataURL(e);
|
|
75
|
+
} else {
|
|
76
|
+
var d = _global.URL || _global.webkitURL, c = d.createObjectURL(e);
|
|
77
|
+
n ? n.location = c : location.href = c, n = null, setTimeout((function() {
|
|
78
|
+
d.revokeObjectURL(c);
|
|
79
|
+
}), 4e4);
|
|
58
80
|
}
|
|
59
|
-
}
|
|
81
|
+
};
|
|
60
82
|
|
|
61
|
-
module.exports =
|
|
83
|
+
module.exports = saveAs;
|
package/lib/utils.js
CHANGED
|
@@ -117,12 +117,14 @@ var stringIsJson = function(e) {
|
|
|
117
117
|
return _isJSON(e);
|
|
118
118
|
}
|
|
119
119
|
}, isKeyInObject = function(e, t) {
|
|
120
|
+
if (isNil(t) || !isObject(t)) return !1;
|
|
120
121
|
isString(e) && (e = [ e ]);
|
|
121
122
|
var n = 0;
|
|
122
123
|
return e.forEach((function(e) {
|
|
123
124
|
e in t && n++;
|
|
124
125
|
})), e.length === n;
|
|
125
126
|
}, isOwnKeyInObject = function(e, t) {
|
|
127
|
+
if (isNil(t) || !isObject(t)) return !1;
|
|
126
128
|
isString(e) && (e = [ e ]);
|
|
127
129
|
var n = 0;
|
|
128
130
|
return e.forEach((function(e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amos-tool",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "amos ui tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "ac-build babel-es5",
|
|
15
15
|
"build2": "rollup -c",
|
|
16
16
|
"doc": "ac-doc docall",
|
|
17
|
-
"pub": "npm run doc && npm run build && npm publish"
|
|
17
|
+
"pub": "npm run doc && npm run build && npm publish",
|
|
18
|
+
"pub2": "npm run doc && npm run build && gulp move && npm publish"
|
|
18
19
|
},
|
|
19
20
|
"repository": {
|
|
20
21
|
"type": "git",
|