npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

random-plus

v0.1.0

Published

Generate random characters string with customizations and file naming support

Readme

Random-plus

A npm module to generate string of random characters

Usage

Import the module, using require('random-plus').

const randomPlus = require('random-plus');

There are 2 methods, .generate() and .generatePlus().

  • The generate(string, number) method is a faster way to generate string of random characters. It expects 2 arguments (length is optional)
    1. The string or array which takes non-multilple characters of each type.
      • A stands for capital letters (A - Z),
      • a stands for small letters (a - z),
      • D or d stands for digits (0 - 9),
      • S stands for special symbols ( !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ ),
      • s stands for safe special symbols ( !#$%&*+,-.=?@^_~ ).
    2. The optional length of the output string, default is 8.

  • The generatePlus(object) method takes options argument to generate string of random characters. It expects 1 object argument with following properties
    1. length: The length of the returned random string. Default is 8
    2. pattern: The pattern, same as the first argument of generate() method.
    3. start: The pattern for the start of the random string. If there are required 2 random capital letters in the beginning, the value of this property should be AA. The number of times is the length of the string that starts with this pattern. Note, only first pattern type is valid, ie, you can't mix, ex: AdA is invalid.
    4. end: The pattern for the end, just like the start
    5. startsWith: The static string that will be added at the beginning of the returned string.
    6. endsWith: The static string that will be appended at the end of the returned string.

Note that length of returned string is exclusive of startsWith and endsWith in case of generatePlus() method.


Examples

To demonstarte the usage.

let randomPlus = require('random-plus');

//Only Capital letters
console.log(randomPlus.generate("A")); //RUOWUSBW

//Only small letters and digits
console.log(randomPlus.generate("aD"), 4); //e29p

//Only small letters, digits and safe symbols
console.log(randomPlus.generate("ads", 10)); //8e01uh+h=7

//Customizing the options
var options = {
  length: 6,
  pattern: "a",
  start: "AA",
  end: "dd",
  startsWith: "image-",
  endsWith: ".jpg"
};

console.log(rp.generatePlus(options)); //image-XGbr08.jpg

//Direct options object
console.log(rp.generatePlus({pattern: "ad", start: "A"})); //Ycz7fhx9

Developed by @abhishekp1996. For any issues, let me know on abhishekp1996[@]gmail[.]com