amos-tool 1.5.2 → 1.6.0
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 +3 -3
- package/docs/index.html +1 -1
- package/index.d.ts +35 -6
- package/lib/dom/fileSaveAs.js +6 -6
- package/lib/locationParams.js +100 -90
- package/lib/utils.js +2 -0
- package/package.json +2 -2
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 Wed Apr 26 2023 17:47:26 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
|
|
|
@@ -16595,7 +16595,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
|
|
|
16595
16595
|
<br class="clear">
|
|
16596
16596
|
|
|
16597
16597
|
<footer>
|
|
16598
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
16598
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Apr 26 2023 17:47:26 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
16599
16599
|
</footer>
|
|
16600
16600
|
|
|
16601
16601
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -785,7 +785,7 @@ convert2BMP(canvas, width, height)</p>
|
|
|
785
785
|
<br class="clear">
|
|
786
786
|
|
|
787
787
|
<footer>
|
|
788
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
788
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Apr 26 2023 17:47:26 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
789
789
|
</footer>
|
|
790
790
|
|
|
791
791
|
<script>prettyPrint();</script>
|
package/index.d.ts
CHANGED
|
@@ -252,17 +252,46 @@ declare namespace LocationParam {
|
|
|
252
252
|
* completeParam({ token: 'xxddf', id: null }, '/main/sub', true); // `/main/sub?token=xxddf&id=`
|
|
253
253
|
* // 使用 location.href, 传入两个参数,强制转化 null 值
|
|
254
254
|
* completeParam({ token: 'xxddf', id: null }, true); // `http://localhost:8080/aaa?token=xxddf&id=`
|
|
255
|
+
*
|
|
256
|
+
* // 叠加值,该方法只会叠加参数,如果需要更新已有字段,以及叠加参数,可以使用 `changeParam`
|
|
257
|
+
* completeParam({ token: 'aa-bb-cc', id: '654321' }, 'a/b/c?token=aaa&id=bcdef'); // `a/b/c?token=aaa&id=bcdef&token=aa-bb-cc&id=654321`
|
|
255
258
|
*/
|
|
256
259
|
export function completeParam(param: Object, url: string, forceCast: Boolean): string;
|
|
257
260
|
/**
|
|
258
|
-
* 替换 url
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
+
* 替换 url 参数。如果url中无指定的参数,则自动追加。
|
|
262
|
+
*
|
|
263
|
+
* 自动将对象中的 undefined 值,转化为 ''。null 值则直接返回 null 字符串。
|
|
264
|
+
*
|
|
265
|
+
* params 参数中的数据格式,建议调用处统一处理为 string 格式。内部仅统一处理 undefined 和 {} 格式。
|
|
266
|
+
* @param href 需要替换参数的 url。为空字符串则直接返回 href
|
|
267
|
+
* @param params 参数对象。为空对象,则直接返回 href。
|
|
261
268
|
* @example
|
|
269
|
+
* // 无参数,自动追加
|
|
270
|
+
* changeParam('a/b/d/g', { a: 1, b: 2, c: 3 }); // 'a/b/d/g?a=1&b=2&c=3'
|
|
271
|
+
* // 更新已有参数的值
|
|
262
272
|
* changeParam('a/b/d/g?a=aa&b=bb&c=cc', { a: 1, b: 2, c: 3 }); // 'a/b/d/g?a=1&b=2&c=3'
|
|
263
|
-
*
|
|
273
|
+
* // url 中无参数 d,自动追加参数
|
|
274
|
+
* changeParam('a/b/d/g?a=aa&b=bb&c=cc', { a: 1, b: 2, c: 3, d: 5 }); // 'a/b/d/g?a=1&b=2&c=3&d=5'
|
|
275
|
+
* // undefined 值转化为 ''
|
|
276
|
+
* changeParam('a/b/d/g', { a: 1, b: 2, c: undefined }); // 'a/b/d/g?a=1&b=2&c='
|
|
277
|
+
* // null 值转化为 'null'
|
|
278
|
+
* changeParam('a/b/d/g', { a: 1, b: null, c: undefined }); // 'a/b/d/g?a=1&b=null&c='
|
|
279
|
+
* // [] 和 {} 值。最好不要给参数中传入 {} 值
|
|
280
|
+
* changeParam('a/b/d/g', { a: { m: 3 }, b: [1,2] }); // a/b/d/g?a={"m":3}&b=1,2
|
|
264
281
|
*/
|
|
265
282
|
export function changeParam(href: String, params: Object): String;
|
|
283
|
+
/**
|
|
284
|
+
* encode 参数中的值
|
|
285
|
+
* @param param
|
|
286
|
+
* @param keys 需要执行 encode 的字段
|
|
287
|
+
* @param processor 自定义 encode 方法,默认采用 `encodeURIComponent`
|
|
288
|
+
* @example
|
|
289
|
+
* encodeParam({ name: 'ilex', email: 'aa@qq.com' }, 'email'); // { name: 'ilex', email: 'aa%40qq.com' }
|
|
290
|
+
* encodeParam({ info: { hobby: 'coding', phone: '155666688881' } }, 'info'); // { info: '%7B%22hobby%22%3A%22coding%22%2C%22phone%22%3A%22155666688881%22%7D' }
|
|
291
|
+
* encodeParam({ split: [1,2,3] }, 'split'); // { split: '%5B1%2C2%2C3%5D' }
|
|
292
|
+
* encodeParam({ star: 18 }, 'star', v => v * 2); // { star: 36 }
|
|
293
|
+
*/
|
|
294
|
+
export function encodeParam(param: {}, keys: String | String[], processor: (arg) => String): {};
|
|
266
295
|
/**
|
|
267
296
|
* 更新浏览器地址栏地址
|
|
268
297
|
* @param param
|
|
@@ -1030,14 +1059,14 @@ declare namespace utils {
|
|
|
1030
1059
|
* 判断key是否在object内
|
|
1031
1060
|
* (采用 in 判断,继承属性均会判断)
|
|
1032
1061
|
* @param keys
|
|
1033
|
-
* @param obj
|
|
1062
|
+
* @param obj 如果 obj 是 null or undefined, 或者 非 object,则直接 返回 false
|
|
1034
1063
|
*/
|
|
1035
1064
|
export function isKeyInObject(keys: string | string[], obj: any): boolean;
|
|
1036
1065
|
/**
|
|
1037
1066
|
* 判断key是否在object内
|
|
1038
1067
|
* (采用 hasOwnProperty 判断,继承属性不会判断)
|
|
1039
1068
|
* @param keys
|
|
1040
|
-
* @param obj
|
|
1069
|
+
* @param obj 如果 obj 是 null or undefined, 或者 非 object,则直接 返回 false
|
|
1041
1070
|
*/
|
|
1042
1071
|
export function isOwnKeyInObject(keys: string | string[], obj: any): boolean;
|
|
1043
1072
|
/**
|
package/lib/dom/fileSaveAs.js
CHANGED
|
@@ -32,7 +32,7 @@ var _saveAs = function(e) {
|
|
|
32
32
|
};
|
|
33
33
|
if (v.readyState = v.INIT, r) return l = n().createObjectURL(t), void setTimeout((function() {
|
|
34
34
|
var e, t;
|
|
35
|
-
o.href = l, o.download = f, e = o, t = new MouseEvent("click"), e.dispatchEvent(t),
|
|
35
|
+
o.href = l, o.download = f, e = o, t = new MouseEvent("click"), e.dispatchEvent(t),
|
|
36
36
|
w(), d(l), v.readyState = v.DONE;
|
|
37
37
|
}));
|
|
38
38
|
!function() {
|
|
@@ -40,7 +40,7 @@ var _saveAs = function(e) {
|
|
|
40
40
|
var o = new FileReader;
|
|
41
41
|
return o.onloadend = function() {
|
|
42
42
|
var t = i ? o.result : o.result.replace(/^data:[^;]*;/, "data:attachment/file;");
|
|
43
|
-
e.open(t, "_blank") || (e.location.href = t), t = void 0, v.readyState = v.DONE,
|
|
43
|
+
e.open(t, "_blank") || (e.location.href = t), t = void 0, v.readyState = v.DONE,
|
|
44
44
|
w();
|
|
45
45
|
}, o.readAsDataURL(t), void (v.readyState = v.INIT);
|
|
46
46
|
}
|
|
@@ -50,12 +50,12 @@ var _saveAs = function(e) {
|
|
|
50
50
|
}, u = f.prototype;
|
|
51
51
|
return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(e, t, n) {
|
|
52
52
|
return t = t || e.name || "download", n || (e = s(e)), navigator.msSaveOrOpenBlob(e, t);
|
|
53
|
-
} : (u.abort = function() {}, u.readyState = u.INIT = 0, u.WRITING = 1, u.DONE = 2,
|
|
54
|
-
u.error = u.onwritestart = u.onprogress = u.onwrite = u.onabort = u.onerror = u.onwriteend = null,
|
|
53
|
+
} : (u.abort = function() {}, u.readyState = u.INIT = 0, u.WRITING = 1, u.DONE = 2,
|
|
54
|
+
u.error = u.onwritestart = u.onprogress = u.onwrite = u.onabort = u.onerror = u.onwriteend = null,
|
|
55
55
|
function(e, t, n) {
|
|
56
56
|
return new f(e, t || e.name || "download", n);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
}, view = "undefined" != typeof self && self || "undefined" != typeof window && window ||
|
|
59
|
+
}, view = "undefined" != typeof self && self || "undefined" != typeof window && window || this.content;
|
|
60
60
|
|
|
61
|
-
module.exports = _saveAs(view);
|
|
61
|
+
module.exports = _saveAs(view);
|
package/lib/locationParams.js
CHANGED
|
@@ -1,141 +1,151 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var utils = require("./utils"), _LSFN = function() {
|
|
4
|
-
var
|
|
4
|
+
var t = [];
|
|
5
5
|
return function() {
|
|
6
|
-
var
|
|
7
|
-
if (utils.isEmpty(
|
|
8
|
-
var
|
|
9
|
-
utils.isNull(
|
|
6
|
+
var n = window.location.search;
|
|
7
|
+
if (utils.isEmpty(n)) throw new Error("the [window.location.search] not empty!");
|
|
8
|
+
var i = n.length > 1 ? n.substring(1) : null;
|
|
9
|
+
utils.isNull(i) || (t = [].slice.call(i.split("&")));
|
|
10
10
|
}(), {
|
|
11
|
-
getValue: function(
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
11
|
+
getValue: function(n) {
|
|
12
|
+
t.forEach((function(t) {
|
|
13
|
+
var i = t.split("=");
|
|
14
|
+
if (i[0] === n) return i[1];
|
|
15
15
|
}));
|
|
16
16
|
},
|
|
17
17
|
getParameters: function() {
|
|
18
|
-
var
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
})),
|
|
18
|
+
var n = [];
|
|
19
|
+
return t.forEach((function(t) {
|
|
20
|
+
n.push(t.split("=")[0]);
|
|
21
|
+
})), n;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}, _LocationSearch = {
|
|
25
25
|
_keyValuePairs: [],
|
|
26
26
|
init: function() {
|
|
27
|
-
var
|
|
28
|
-
if (utils.isEmpty(
|
|
29
|
-
var
|
|
30
|
-
return utils.isNull(
|
|
27
|
+
var t = window.location.search;
|
|
28
|
+
if (utils.isEmpty(t)) throw new Error("the [window.location.search] not empty!");
|
|
29
|
+
var n = t.length > 1 ? t.substring(1) : null;
|
|
30
|
+
return utils.isNull(n) || (_LocationSearch._keyValuePairs = [].slice.call(n.split("&"))),
|
|
31
31
|
this;
|
|
32
32
|
},
|
|
33
|
-
getValue: function(
|
|
34
|
-
_LocationSearch._keyValuePairs.forEach((function(
|
|
35
|
-
var
|
|
36
|
-
if (
|
|
33
|
+
getValue: function(t) {
|
|
34
|
+
_LocationSearch._keyValuePairs.forEach((function(n) {
|
|
35
|
+
var i = n.split("=");
|
|
36
|
+
if (i[0] === t) return i[1];
|
|
37
37
|
}));
|
|
38
38
|
},
|
|
39
39
|
getParameters: function() {
|
|
40
|
-
var
|
|
41
|
-
return _LocationSearch._keyValuePairs.forEach((function(
|
|
42
|
-
|
|
43
|
-
})),
|
|
40
|
+
var t = [];
|
|
41
|
+
return _LocationSearch._keyValuePairs.forEach((function(n) {
|
|
42
|
+
t.push(n.split("=")[0]);
|
|
43
|
+
})), t;
|
|
44
44
|
}
|
|
45
45
|
}, LocationParam = {
|
|
46
|
-
parse: function(
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
var a = {},
|
|
50
|
-
if (!utils.isEmpty(
|
|
51
|
-
|
|
46
|
+
parse: function(t) {
|
|
47
|
+
var n, i, e, r, o;
|
|
48
|
+
t || (t = window.location.search);
|
|
49
|
+
var a = {}, s = [];
|
|
50
|
+
if (!utils.isEmpty(t) && t.length > 1) for (r = 0, o = (s = t.slice(1 + t.indexOf("?"), t.length).split("&")).length; r < o; r++) n = (i = (i = s[r]).split("="))[0],
|
|
51
|
+
e = i[1], n in a ? (utils.isArray(a[n]) || (a[n] = [ a[n] ]), a[n].push(decodeURIComponent(e))) : a[n] = decodeURIComponent(e);
|
|
52
52
|
return a;
|
|
53
53
|
},
|
|
54
|
-
paramSearch: function(
|
|
55
|
-
if (utils.isUndefined(
|
|
56
|
-
if (
|
|
57
|
-
for (var
|
|
58
|
-
var o =
|
|
59
|
-
1 === o.length ?
|
|
54
|
+
paramSearch: function(t, n) {
|
|
55
|
+
if (utils.isUndefined(n) || utils.isNull(n)) {
|
|
56
|
+
if (n = window.location.search, utils.isUndefined(t) || utils.isNull(t)) {
|
|
57
|
+
for (var i = n.substr(1, n.length - 1).split("&"), e = {}, r = 0; r < i.length; r++) {
|
|
58
|
+
var o = i[r].split("=");
|
|
59
|
+
1 === o.length ? e[o[0]] = "" : 2 === o.length ? e[o[0]] = decodeURIComponent(o[1]) : console.log("there is something wrong when use [paramSearch]!");
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return e;
|
|
62
62
|
}
|
|
63
63
|
try {
|
|
64
|
-
var a = new RegExp(
|
|
65
|
-
return decodeURIComponent(
|
|
66
|
-
} catch (
|
|
64
|
+
var a = new RegExp(t + "=([^&]+)?");
|
|
65
|
+
return decodeURIComponent(n.match(a)[1]);
|
|
66
|
+
} catch (t) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
getLocationParams: function() {
|
|
72
|
-
var
|
|
73
|
-
if (!utils.isEmpty(
|
|
74
|
-
var r =
|
|
75
|
-
if (r < -1) console.log("the location.href is invalid!"); else for (var o = (
|
|
76
|
-
|
|
72
|
+
var t, n, i = {}, e = window.location.href;
|
|
73
|
+
if (!utils.isEmpty(e)) {
|
|
74
|
+
var r = e.indexOf("?");
|
|
75
|
+
if (r < -1) console.log("the location.href is invalid!"); else for (var o = (e = e.substr(r + 1)).split("&"), a = 0; a < o.length; a++) (r = o[a].indexOf("=")) > 0 && (t = o[a].substring(0, r),
|
|
76
|
+
n = o[a].substr(r + 1), i[t] = decodeURIComponent(n));
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return i;
|
|
79
79
|
},
|
|
80
|
-
getLocationParamByName: function(
|
|
81
|
-
var
|
|
82
|
-
return null !=
|
|
80
|
+
getLocationParamByName: function(t) {
|
|
81
|
+
var n = new RegExp("(^|&?)".concat(t, "=([^&]*)(&|$)")), i = window.location.search.substr(1).match(n);
|
|
82
|
+
return null != i ? decodeURIComponent(i[2]) : null;
|
|
83
83
|
},
|
|
84
|
-
getParameter: function(
|
|
85
|
-
var
|
|
86
|
-
return
|
|
84
|
+
getParameter: function(t, n) {
|
|
85
|
+
var i = new RegExp("(\\?|#|&)" + n + "=([^&#]*)(&|#|$)"), e = t.match(i);
|
|
86
|
+
return e ? e[2] : "";
|
|
87
87
|
},
|
|
88
|
-
extractParam: function(
|
|
89
|
-
if (!
|
|
90
|
-
var
|
|
91
|
-
return utils.isNil(
|
|
88
|
+
extractParam: function(t, n) {
|
|
89
|
+
if (!t) return null;
|
|
90
|
+
var i = new RegExp("(^|&?)".concat(n, "=([^&]*)(&|$)")), e = t.substr(1).match(i);
|
|
91
|
+
return utils.isNil(e) ? null : decodeURIComponent(e[2]);
|
|
92
92
|
},
|
|
93
|
-
extractParams: function(
|
|
94
|
-
var
|
|
93
|
+
extractParams: function(t) {
|
|
94
|
+
var n, i, e = {}, r = t || window.location.href;
|
|
95
95
|
if (!utils.isEmpty(r)) {
|
|
96
96
|
var o = r.indexOf("?");
|
|
97
|
-
if (o < -1) console.log("the location.href is invalid!"); else for (var a = (r = r.substr(o + 1)).split("&"),
|
|
98
|
-
|
|
97
|
+
if (o < -1) console.log("the location.href is invalid!"); else for (var a = (r = r.substr(o + 1)).split("&"), s = 0; s < a.length; s++) (o = a[s].indexOf("=")) > 0 && (n = a[s].substring(0, o),
|
|
98
|
+
i = a[s].substr(o + 1), e[n] = decodeURIComponent(i));
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return e;
|
|
101
101
|
},
|
|
102
|
-
extractParamAll: function(
|
|
103
|
-
var
|
|
102
|
+
extractParamAll: function(t) {
|
|
103
|
+
var n, i, e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = {}, o = t || window.location.href;
|
|
104
104
|
if (!utils.isEmpty(o)) {
|
|
105
105
|
var a = o.indexOf("?");
|
|
106
|
-
if (a < -1) console.log("the location.href is invalid!"); else for (var
|
|
107
|
-
|
|
106
|
+
if (a < -1) console.log("the location.href is invalid!"); else for (var s = (o = o.substr(a + 1)).split("&"), l = 0; l < s.length; l++) (a = s[l].indexOf("=")) > 0 && (n = s[l].substring(0, a),
|
|
107
|
+
i = s[l].substr(a + 1), r[n] = e ? decodeURIComponent(i) : i);
|
|
108
108
|
}
|
|
109
109
|
return r;
|
|
110
110
|
},
|
|
111
|
-
completeParam: function(
|
|
112
|
-
var
|
|
113
|
-
1 ===
|
|
114
|
-
|
|
115
|
-
var r = (Object.keys(
|
|
116
|
-
var r =
|
|
117
|
-
return
|
|
111
|
+
completeParam: function(t, n, i) {
|
|
112
|
+
var e = arguments;
|
|
113
|
+
1 === e.length ? n || (n = window.location.href) : 2 === e.length && utils.isBoolean(n) && (i = n,
|
|
114
|
+
n = window.location.href), utils.isUndefined(i) && (i = !1), n || (n = window.location.href);
|
|
115
|
+
var r = (Object.keys(t) || []).reduce((function(n, e) {
|
|
116
|
+
var r = t[e];
|
|
117
|
+
return i && (utils.isNull(r) || utils.isUndefined(r)) && (r = ""), n += "&".concat(e, "=").concat(r);
|
|
118
118
|
}), "");
|
|
119
|
-
return r ? (r = r.slice(1), -1 !==
|
|
119
|
+
return r ? (r = r.slice(1), -1 !== n.indexOf("?") ? n.endsWith("?") ? "".concat(n).concat(r) : "".concat(n, "&").concat(r) : "".concat(n, "?").concat(r)) : n;
|
|
120
120
|
},
|
|
121
|
-
changeParam: function(
|
|
122
|
-
if (!
|
|
123
|
-
var
|
|
124
|
-
return Object.keys(
|
|
125
|
-
var
|
|
126
|
-
utils.isUndefined(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
changeParam: function(t, n) {
|
|
122
|
+
if (!t || utils.isEmpty(n)) return t;
|
|
123
|
+
var i = t;
|
|
124
|
+
return Object.keys(n).forEach((function(t) {
|
|
125
|
+
var e = n[t];
|
|
126
|
+
utils.isUndefined(e) ? e = "" : utils.isArray(e) || utils.isObject(e) && (e = JSON.stringify(e)),
|
|
127
|
+
i = function(t, n, i) {
|
|
128
|
+
var e = n + "=([^&]*)", r = n + "=" + i;
|
|
129
|
+
if (t.match(e)) {
|
|
130
|
+
var o = new RegExp("(".concat(n, "=)([^&]*)"), "gi");
|
|
131
|
+
return t.replace(o, r);
|
|
131
132
|
}
|
|
132
|
-
return
|
|
133
|
-
}(
|
|
134
|
-
})),
|
|
133
|
+
return t.match("[?]") ? t + "&" + r : t + "?" + r;
|
|
134
|
+
}(i, t, e);
|
|
135
|
+
})), i;
|
|
136
|
+
},
|
|
137
|
+
encodeParam: function(t, n, i) {
|
|
138
|
+
if (utils.isNil(n) || !utils.isObject(t)) return t;
|
|
139
|
+
utils.isString(n) && (n = [ n ]);
|
|
140
|
+
for (var e = utils.clone(t), r = 0, o = n.length; r < o; r++) {
|
|
141
|
+
var a = n[r];
|
|
142
|
+
utils.isNil(e[a]) || (i ? e[a] = i(e[a]) : utils.isString(e[a]) ? e[a] = encodeURIComponent(e[a]) : (utils.isOnlyObject(e[a]) || utils.isArray(e[a])) && (e[a] = encodeURIComponent(JSON.stringify(e[a]))));
|
|
143
|
+
}
|
|
144
|
+
return e;
|
|
135
145
|
},
|
|
136
|
-
replaceUrl: function(
|
|
137
|
-
var
|
|
138
|
-
|
|
146
|
+
replaceUrl: function(t, n) {
|
|
147
|
+
var i = n || location.href;
|
|
148
|
+
i = LocationParam.changeParam(i, t), location.replace(i);
|
|
139
149
|
},
|
|
140
150
|
LocationSearch: _LocationSearch,
|
|
141
151
|
LSFN: _LSFN
|
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.0",
|
|
4
4
|
"description": "amos ui tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"testUUID": "mocha tests/uuid.test",
|
|
12
12
|
"testFilter": "mocha tests/tablefilter.test",
|
|
13
13
|
"docs": "node_modules/.bin/jsdoc -c jsdoc-ori.json --readme README.md",
|
|
14
|
-
"build": "ac-build babel-es5",
|
|
14
|
+
"build": "ac-build babel-es5 && gulp move",
|
|
15
15
|
"build2": "rollup -c",
|
|
16
16
|
"doc": "ac-doc docall",
|
|
17
17
|
"pub": "npm run doc && npm run build && npm publish"
|