puvox-library 1.0.20 → 1.0.22

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.
Files changed (2) hide show
  1. package/library_standard.js +24 -31
  2. package/package.json +1 -1
@@ -588,41 +588,34 @@ const puvox_library =
588
588
 
589
589
  argvsString(){ return process.argv[2]; },
590
590
  argvsArray(){ return process.argv.slice(2); },
591
- argv(which, def = undefined){
592
- var which = which || undefined;
591
+ argvs(){
593
592
  let argvs= this.argvsArray();
594
- if (argvs.length <= 0)
595
- {
596
- return def;
597
- }
598
- else{
599
- let KeyValues= {};
600
- for (let i=0; i<argvs.length; i++){
601
- let argumentString = argvs[i]; // each argument
602
- let pair = {};
603
- if ( argumentString.includes('=') ){
604
- pair = this.parseQuery(argumentString);
605
- } else {
606
- pair[argumentString] = undefined;
607
- }
608
- let pairKey= Object.keys(pair)[0];
609
- // if member already exists (i.e: cli key1=val1 key2=val2 key1=xyz..)
610
- if (pairKey in KeyValues){
611
- // if not array yet
612
- if (!Array.isArray(KeyValues[pairKey]))
613
- {
614
- KeyValues[pairKey] = [ KeyValues[pairKey], pair[pairKey]];
615
- }
616
- // if already array-ed
617
- else {
618
- KeyValues[pairKey] = KeyValues[pairKey].concat([pair[pairKey]]);
619
- }
620
- } else {
621
- KeyValues = Object.assign (KeyValues, pair);
593
+ let KeyValues= {};
594
+ for (let i=0; i<argvs.length; i++){
595
+ let argumentString = argvs[i]; // each argument
596
+ let pair = {};
597
+ if ( argumentString.includes('=') ){
598
+ pair = this.parseQuery(argumentString);
599
+ } else {
600
+ pair[argumentString] = undefined;
601
+ }
602
+ let pairKey= Object.keys(pair)[0];
603
+ // if member already exists (i.e: cli key1=val1 key2=val2 key1=xyz..)
604
+ if (pairKey in KeyValues){
605
+ // if not array yet
606
+ if (!Array.isArray(KeyValues[pairKey]))
607
+ {
608
+ KeyValues[pairKey] = [ KeyValues[pairKey], pair[pairKey]];
609
+ }
610
+ // if already array-ed
611
+ else {
612
+ KeyValues[pairKey] = KeyValues[pairKey].concat([pair[pairKey]]);
622
613
  }
614
+ } else {
615
+ KeyValues = Object.assign (KeyValues, pair);
623
616
  }
624
- return (which==undefined ? KeyValues : (which in KeyValues ? KeyValues[which] : undefined) );
625
617
  }
618
+ return KeyValues;
626
619
  },
627
620
  argvIsSet(which){
628
621
  return this.inArray(which, this.argvsArray()) || this.argv(which)!=undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puvox-library",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "library-class-javascript",
5
5
  "main": "library_standard.js",
6
6
  "scripts": {