random-id-sqf
v1.0.10
Published
⚡ GetID: A Lightweight Random ID Generator
Downloads
460
Readme
⚡ GetID: A Lightweight Random ID Generator
A lightweight JavaScript utility to generate random IDs of any length.
Perfect for creating unique identifiers for users, sessions, or temporary tokens.
📦 Installation
Install via npm:
npm install getid-sq
⚠️ Important: ES Modules
This package uses ES Module syntax.
Make sure your project has "type": "module" in your package.json:
{ "type": "module" }
Without this, the following import will throw an error:
import GetID from "getid-sq";
🛠️ Usage
import GetID from "getid-sq";
const id = GetID(10); console.log(id); // e.g., "aB3@cD!1eF"
You can use it anywhere in your JavaScript project that supports ES Modules.
📖 API
GetID(length)
Generates a random string of the specified length.
Parameter
Type
Description
Required
length
number
Length of the ID.
Yes
Returns:
string: A random string containing letters, numbers, and special characters.
Examples:
GetID(5); // "a1!bC" GetID(12); // "A!2cD@3fG!1" GetID(20); // "r@nd0m!ch@r@ct3rs!"
📝 Notes
The function includes letters (a-z, A-Z), numbers (0-9), and special characters like @, !, #, %, &, etc.
The generated ID is random on each call.
Remember to set "type": "module" in your package.json to use import syntax.
✨ Quick Tips
Use this function for temporary passwords, session tokens, unique keys, or anywhere random strings are needed.
Adjust the length parameter to control the size of the ID.
🤝 Contributing
Contributions are welcome!
Fork the repo
Make changes or improvements
Submit a pull request
Please follow standard code practices and keep it clean.
📜 License
MIT
