Skip to content

vigneshwarvj/random-string-generator-library-npm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

This repository contains npm library that is used to Generate-Random-String

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published