Add a helper function to "parse_hash_arguments"

This commit is contained in:
Bofh 2022-11-24 02:34:20 +01:00
parent 93bd536efe
commit f7498566f8
1 changed files with 13 additions and 2 deletions

View File

@ -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) {