12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- var variableList={};
- variableList.parseVariables=
- function(pars){
- let pA=pars.split(";");
- let q=new Object();
- for (let i=0;i<pA.length;i++){
- let vA=pA[i].split('=');
- q[vA[0]]=vA[vA.length-1];
- }
- return q;
- }
- variableList.printVariables=
- function(parentClass,q){
- let fName="[printVariables]";
- for (let x in q){
- parentClass.print(fName+" ["+x+"] "+q[x]);
- }
- }
- variableList.hasVariable=
- function(q,varName){
- if (q && varName in q)
- return true;
- return false;
- }
- variableList.isFilterList=
- function(v){
- if (typeof(v)!='string') return false;
- if (v.search(';')==-1) return false;
- return true;
- }
- variableList.convertToDictionary=
- function(rows){
- let x=new Array();
- for (let i=0;i<rows.length;i++){
- let n=rows[i]['name'];
- let v=rows[i]['value'];
- x[n]=v;
- }
- return x;
- }
-
- variableList.convertToAssociatedArray=
- function(rows,fieldName="name"){
- let x=new Object();
- for (let i=0;i<rows.length;i++){
- let n=rows[i][fieldName];
- x[n]=rows[i];
- }
- return x;
- }
|