@reldens/utils 0.13.0 → 0.14.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.
Files changed (2) hide show
  1. package/lib/shortcuts.js +19 -0
  2. package/package.json +1 -1
package/lib/shortcuts.js CHANGED
@@ -141,6 +141,25 @@ class Shortcuts
141
141
  return date.toISOString().slice(0, 19).replace('T', ' ');
142
142
  }
143
143
 
144
+ randomInteger(min, max)
145
+ {
146
+ return Math.floor(Math.random() * (max - min + 1)) + min;
147
+ }
148
+
149
+ randomChars(length)
150
+ {
151
+ if(0 >= length){
152
+ return '';
153
+ }
154
+ let result = '';
155
+ let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
156
+ let charactersLength = characters.length;
157
+ for(let i=0; i < length; i++){
158
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
159
+ }
160
+ return result;
161
+ }
162
+
144
163
  }
145
164
 
146
165
  module.exports = new Shortcuts();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/utils",
3
3
  "scope": "@reldens",
4
- "version": "0.13.0",
4
+ "version": "0.14.0",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",