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.
You can install the package via npm:
npm install namegen
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"
- Input: A base name (string).
- Output: A new name formed by appending two random letters and one random digit to the base name.
console.log(NameGen("Alice")); // Possible Output: "Alicebx2"
console.log(NameGen("Bob")); // Possible Output: "Bobyt5"
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.
If you have any ideas, suggestions, or issues, feel free to open an issue or submit a pull request.
Nikhil Hazari
For any inquiries or support, please contact me at: nikhilhazari100@gmail.com