puvox-library 1.0.20 → 1.0.21

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