easyname-generator
v1.0.1
Published
easyname-generator is a simple and lightweight JavaScript function designed to generate unique names by appending two random letters and a digit to a given base name. This can be useful for creating usernames, IDs, or other identifiers where a bit of rand
Downloads
6
Readme
easyname-generator
easyname-generator is a lightweight JavaScript function designed to generate unique names by appending two random letters and a digit to a given base name. It’s perfect for creating unique usernames, IDs, or other identifiers where a bit of randomness is needed.
Installation
You can install the package via npm:
npm install namegen
Usage
Here’s a basic example of how to use the NameGen
function:
const NameGen = require('easyname-generator');
const uniqueName = NameGen("John");
console.log(uniqueName); // Example Output: "Johnaf7"
Functionality
- Input: A base name (string).
- Output: A new name formed by appending two random letters and one random digit to the base name.
Example
console.log(NameGen("Alice")); // Possible Output: "Alicebx2"
console.log(NameGen("Bob")); // Possible Output: "Bobyt5"
How It Works
The NameGen
function works by:
- Generating two random letters from the English alphabet.
- Generating a random digit between 0 and 9.
- Appending these characters to the provided base name.
This ensures that the generated name is unique and somewhat unpredictable.
Contributing
If you have any ideas, suggestions, or issues, feel free to open an issue or submit a pull request.
Author
Nikhil Hazari
Contact
For any inquiries or support, please contact me at: [email protected]