Add a helper function to "parse_hash_arguments"
This commit is contained in:
parent
93bd536efe
commit
f7498566f8
15
js/base.php
15
js/base.php
|
@ -106,9 +106,20 @@ function _get_func_params(func) {
|
|||
return params;
|
||||
}
|
||||
|
||||
function capitalize(str) {
|
||||
return str[0].toUpperCase() + str.substring(1);
|
||||
function parse_hash_arguments(str) {
|
||||
var args = {};
|
||||
const ps = str.trim().split(';');
|
||||
for (var i = 0; i < ps.length; i++) {
|
||||
const k = ps[i].substr(0,ps[i].indexOf('='));
|
||||
const v = ps[i].substr(ps[i].indexOf('=')+1);
|
||||
if (k.trim() === '')
|
||||
continue;
|
||||
args[k] = v;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
function capitalize(str) { return str[0].toUpperCase() + str.substring(1) }
|
||||
function printstack() { console.error(new Error().stack) }
|
||||
function uuidv4() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
|
|
Loading…
Reference in New Issue