+36
| # quickid | ||
| quickid is a lightweight and efficient npm package designed to generate unique and random IDs effortlessly. With simplicity in mind, Quick ID provides a single function, `generate()`, which returns a randomly generated alphanumeric string of a specified length. | ||
| ## Key Features | ||
| - **Easy Integration:** Incorporate Quick ID seamlessly into your projects with a single function call. | ||
| - **Customizable Length:** Tailor the length of the generated IDs to suit your specific requirements. | ||
| - **Efficient and Lightweight:** Quick ID is designed for efficiency, ensuring minimal impact on performance while delivering reliable and unique identifiers. | ||
| ## Installation | ||
| Install Quick ID in your project using npm: | ||
| ```bash | ||
| npm install quickid or yarn add quickid | ||
| ``` | ||
| ## Usage | ||
| ``` javascript | ||
| const quickId = require('quick-id'); | ||
| // Generate a default 8-character ID | ||
| const id = quickId.generate(); | ||
| console.log(id); | ||
| ``` | ||
| You can customize the length of the generated ID by providing an argument to the generate function: | ||
| ```javascript | ||
| const customLength = 12; | ||
| const customId = quickId.generate(customLength); | ||
| console.log(customId); | ||
| ``` | ||
| ## Contributing | ||
| Contributions are welcome! If you encounter a bug or have a feature request, please open an issue or submit a pull request. |
+2
-3
| const getRandomIndex = (max) => Math.floor(Math.random() * max); | ||
| const generate = () => { | ||
| const generate = (length = 8) => { | ||
| const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; | ||
| const ID_LENGTH = 8; | ||
| let result = ''; | ||
| for (let i = 0; i < ID_LENGTH; i++) { | ||
| for (let i = 0; i < length; i++) { | ||
| const randomIndex = getRandomIndex(characters.length); | ||
@@ -10,0 +9,0 @@ result += characters.charAt(randomIndex); |
+1
-1
| { | ||
| "name": "quickid", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "Quick ID is a lightweight and efficient npm package designed to generate unique and random IDs effortlessly. With simplicity in mind, Quick ID provides a single function, quickId(), which returns a randomly generated alphanumeric string of a specified length.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2313
127.66%3
50%1
-50%36
Infinity%13
-7.14%