puvox-library 1.0.40 → 1.0.42

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.
@@ -2469,7 +2469,9 @@ const puvox_library =
2469
2469
  arrayRemoveValue(array, value) {
2470
2470
  const newArray = [...array];
2471
2471
  const index = newArray.indexOf(value);
2472
- newArray.splice(index, 1);
2472
+ if (index > -1){
2473
+ newArray.splice(index, 1);
2474
+ }
2473
2475
  return newArray;
2474
2476
  },
2475
2477
 
@@ -3074,7 +3076,7 @@ const puvox_library =
3074
3076
  fs() {return require('fs');}, //puvox_library.modules('fs')
3075
3077
  os() {return require('os');},
3076
3078
  path() {return require('path');},
3077
- //
3079
+ // ends with slash
3078
3080
  tempDir(){ return puvox_library.trailingSlash(this.os().tmpdir()); },
3079
3081
 
3080
3082
  exists(filePath){
@@ -3119,6 +3121,26 @@ const puvox_library =
3119
3121
  return filesList;
3120
3122
  },
3121
3123
  },
3124
+ options: {
3125
+ fileLocation(suffix = '') {
3126
+ return puvox_library.file.tempDir() + puvox_library.getAppName() + '_' + suffix + '.json';
3127
+ },
3128
+ get(groupName, optName, defaultVal = null){
3129
+ const fileName = this.fileLocation(groupName);
3130
+ const content = puvox_library.file.read(fileName, '{}');
3131
+ const json = JSON.parse(content);
3132
+ return (optName in json) ? json[optName] : defaultVal;
3133
+ },
3134
+ set(groupName, optName, val){
3135
+ const fileName = this.fileLocation(groupName);
3136
+ const content = puvox_library.file.read(fileName, '{}');
3137
+ const json = JSON.parse(content);
3138
+ json[optName] = val;
3139
+ puvox_library.file.write(fileName, JSON.stringify(json));
3140
+ }
3141
+ },
3142
+
3143
+
3122
3144
 
3123
3145
 
3124
3146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puvox-library",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "library-class-javascript",
5
5
  "main": "library_standard.js",
6
6
  "scripts": {