@reldens/utils 0.24.0 → 0.26.0

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.
@@ -31,6 +31,11 @@ class FileHandler
31
31
  fs.mkdirSync(folderPath, { recursive: true });
32
32
  }
33
33
 
34
+ readFile(filePath)
35
+ {
36
+ return fs.readFileSync(filePath);
37
+ }
38
+
34
39
  async writeFile(fileName, content)
35
40
  {
36
41
  return fs.writeFile(fileName, content, this.encoding, (err) => {
package/lib/shortcuts.js CHANGED
@@ -128,6 +128,11 @@ class Shortcuts
128
128
  }
129
129
  }
130
130
 
131
+ deepJsonClone(obj)
132
+ {
133
+ return JSON.parse(JSON.stringify(obj));
134
+ }
135
+
131
136
  get(obj, prop, defaultReturn)
132
137
  {
133
138
  return this.hasOwn(obj, prop) ? obj[prop] : defaultReturn;
@@ -274,6 +279,14 @@ class Shortcuts
274
279
  return Number(number.toFixed(precision));
275
280
  }
276
281
 
282
+ randomValueFromArray(array)
283
+ {
284
+ if(!this.isArray(array) || 0 === array.length){
285
+ return null;
286
+ }
287
+ return array[Math.floor(Math.random() * array.length)];
288
+ }
289
+
277
290
  randomInteger(min, max)
278
291
  {
279
292
  return Math.floor(Math.random() * (max - min + 1)) + min;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/utils",
3
3
  "scope": "@reldens",
4
- "version": "0.24.0",
4
+ "version": "0.26.0",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",