idchunk 1.0.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.
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
package/LICENSE ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "idchunk",
3
+ "version": "1.0.0",
4
+ "description": "A tiny, fast and customizable ID generator like NanoID.",
5
+ "main": "src/index.js",
6
+ "keywords": [
7
+ "id",
8
+ "nanoid",
9
+ "generator",
10
+ "random",
11
+ "unique",
12
+ "uid"
13
+ ],
14
+ "author": "Garv Thakral",
15
+ "license": "MIT"
16
+ }
package/src/index.js ADDED
@@ -0,0 +1,16 @@
1
+ const values = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
2
+
3
+ const idchunk = (length) =>{
4
+ length = length || 10;
5
+ let result = '';
6
+ const valuesLength = values.length;
7
+
8
+ for (let i = 0; i < length; i++) {
9
+ result += values.charAt(Math.floor(Math.random() * valuesLength));
10
+ }
11
+
12
+ return result;
13
+ }
14
+
15
+ const randomNumber = idchunk(3);
16
+ module.exports = idchunk;
@@ -0,0 +1,3 @@
1
+ const idchunk = require('../src/index.js');
2
+
3
+ console.log("Generated ID:", idchunk(6));