random-string-generator-library
v1.0.0
Published
The random-string-generator-library is a lightweight utility library for generating random strings in Node.js or browser environments. It provides a simple function for creating strings with a specified length, using a customizable character set.
Downloads
12
Maintainers
Readme
Random String Generator
The random-string-generator-library
is a lightweight utility library for generating random strings in Node.js or browser environments. It provides a simple function for creating strings with a specified length, using a customizable character set.
Installation
Install the library using npm:
npm install random-string-generator-library
Usage
The randomStringGenerator
function exports a single method that can be used to generate random strings.
const { generateRandomString } = require('random-string-generator');
// Generate a random string of length 10
const randomString = generateRandomString(10);
console.log(randomString);
API
generateRandomString(length: number): string
Generates a random string of the specified length using a default character set of uppercase letters, lowercase letters, and digits.
- Parameters:
length
: The length of the generated random string.
- Returns:
- A randomly generated string.
Examples:
const { generateRandomString } = require('random-string-generator');
// Generate a random string of length 8
const randomString1 = generateRandomString(8);
console.log(randomString1); // Output: "Yh8d3g9n"
// Generate another random string of length 5
const randomString2 = generateRandomString(5);
console.log(randomString2); // Output: "Ap1i9"
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Feel free to contribute, report issues, or suggest improvements. Contributions are welcome!
Contact
For any inquiries or collaboration opportunities, feel free to reach out:
- LinkedIn:ℹ️ Vigneshwar Vijayakumar (VV)
- Email:📧 Mail me