random-string-generator-library
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Random String Generator

npm version license

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:

Package Sidebar

Install

npm i random-string-generator-library

Weekly Downloads

17

Version

1.0.0

License

MIT

Unpacked Size

5.47 kB

Total Files

5

Last publish

Collaborators

  • vigneshvijay.vv