amos-tool 1.4.12 → 1.4.13
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 +2 -0
- package/docs/Logger.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +3 -1
- package/index.d.ts +10 -0
- package/lib/locationParams.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -339,6 +339,8 @@ const result2 = browserSupport(paramsList, limit);
|
|
|
339
339
|
|
|
340
340
|
getParameter(url, name):
|
|
341
341
|
`get target url Parameter by name, and return value or '' `
|
|
342
|
+
extractParam(url, name): `解析指定 url 中的参数,返回指定 name 的参数`
|
|
343
|
+
extractParams(url): `解析指定 url 中的参数,参数对象,如果 url 为undefined,则默认采用 window.location.href`
|
|
342
344
|
|
|
343
345
|
`LocationSearch` LocationParam.LocationSearch
|
|
344
346
|
`other search tool`
|
package/docs/Logger.html
CHANGED
|
@@ -334,7 +334,7 @@ isDebug: true
|
|
|
334
334
|
<br class="clear">
|
|
335
335
|
|
|
336
336
|
<footer>
|
|
337
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
337
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
338
338
|
</footer>
|
|
339
339
|
|
|
340
340
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -15477,7 +15477,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
|
|
|
15477
15477
|
<br class="clear">
|
|
15478
15478
|
|
|
15479
15479
|
<footer>
|
|
15480
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
15480
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
15481
15481
|
</footer>
|
|
15482
15482
|
|
|
15483
15483
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -451,6 +451,8 @@ const result2 = browserSupport(paramsList, limit);
|
|
|
451
451
|
|
|
452
452
|
getParameter(url, name):
|
|
453
453
|
`get target url Parameter by name, and return value or '' `
|
|
454
|
+
extractParam(url, name): `解析指定 url 中的参数,返回指定 name 的参数`
|
|
455
|
+
extractParams(url): `解析指定 url 中的参数,参数对象,如果 url 为undefined,则默认采用 window.location.href`
|
|
454
456
|
|
|
455
457
|
`LocationSearch` LocationParam.LocationSearch
|
|
456
458
|
`other search tool`
|
|
@@ -781,7 +783,7 @@ convert2BMP(canvas, width, height)</p>
|
|
|
781
783
|
<br class="clear">
|
|
782
784
|
|
|
783
785
|
<footer>
|
|
784
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
786
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
785
787
|
</footer>
|
|
786
788
|
|
|
787
789
|
<script>prettyPrint();</script>
|
package/index.d.ts
CHANGED
|
@@ -190,8 +190,18 @@ declare namespace LocationParam {
|
|
|
190
190
|
* 获取指定 url 中的参数,仅匹配 &
|
|
191
191
|
* @param url
|
|
192
192
|
* @param name
|
|
193
|
+
* @example
|
|
194
|
+
* extractParam('/vizmixpub?appId=1536262837746302978&id=1536264796842786817&designerType=vizmix&isPreview=true', 'id'); // 1536264796842786817
|
|
193
195
|
*/
|
|
194
196
|
export function extractParam(url: string, name: string): string | null;
|
|
197
|
+
/**
|
|
198
|
+
* 获取 url 中参数集合
|
|
199
|
+
* @param url
|
|
200
|
+
* @example
|
|
201
|
+
* extractParam('/vizmixpub?appId=1536262837746302978&id=1536264796842786817&designerType=vizmix&isPreview=true', 'id');
|
|
202
|
+
* // { appId: '1536262837746302978', id: '1536264796842786817', designerType: 'vizmix', isPreview: 'true' }
|
|
203
|
+
*/
|
|
204
|
+
export function extractParams(url: string): Object;
|
|
195
205
|
/**
|
|
196
206
|
* 补全参数
|
|
197
207
|
* @param {*} param
|
package/lib/locationParams.js
CHANGED
|
@@ -78,7 +78,7 @@ var utils = require("./utils"), _LSFN = function() {
|
|
|
78
78
|
return e;
|
|
79
79
|
},
|
|
80
80
|
getLocationParamByName: function(t) {
|
|
81
|
-
var n = new RegExp("(
|
|
81
|
+
var n = new RegExp("(^|&?)".concat(t, "=([^&]*)(&|$)")), e = window.location.search.substr(1).match(n);
|
|
82
82
|
return null != e ? decodeURIComponent(e[2]) : null;
|
|
83
83
|
},
|
|
84
84
|
getParameter: function(t, n) {
|
|
@@ -86,9 +86,18 @@ var utils = require("./utils"), _LSFN = function() {
|
|
|
86
86
|
return i ? i[2] : "";
|
|
87
87
|
},
|
|
88
88
|
extractParam: function(t, n) {
|
|
89
|
-
var e = new RegExp("(^|&?)".concat(n, "=([^&]*)(&|$)")
|
|
89
|
+
var e = new RegExp("(^|&?)".concat(n, "=([^&]*)(&|$)")), i = t.substr(1).match(e);
|
|
90
90
|
return utils.isNil(i) ? null : decodeURIComponent(i[2]);
|
|
91
91
|
},
|
|
92
|
+
extractParams: function(t) {
|
|
93
|
+
var n, e, i = {}, r = t || window.location.href;
|
|
94
|
+
if (!utils.isEmpty(r)) {
|
|
95
|
+
var o = r.indexOf("?");
|
|
96
|
+
if (o < -1) console.log("the location.href is invalid!"); else for (var a = (r = r.substr(o + 1)).split("&"), c = 0; c < a.length; c++) (o = a[c].indexOf("=")) > 0 && (n = a[c].substring(0, o),
|
|
97
|
+
e = a[c].substr(o + 1), i[n] = decodeURIComponent(e));
|
|
98
|
+
}
|
|
99
|
+
return i;
|
|
100
|
+
},
|
|
92
101
|
completeParam: function(t, n) {
|
|
93
102
|
n || (n = window.location.href);
|
|
94
103
|
var e = (Object.keys(t) || []).reduce((function(n, e) {
|