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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gerandchars

v1.2.6

Published

Generate Random Characters and More

Downloads

27

Readme

Generate Random Characters

An npm package that can generate random strings, numbers and more

Installation

Install with npm

npm install gerandchars

or connect with CDN

https://www.unpkg.com/gerandchars@latest/gerandchars.js

Import

With require

const gerandchars = require('gerandchars');

Connect with CDN

<script src="https://www.unpkg.com/gerandchars@latest/gerandchars.js"></script>

Usage

To use it you only need to call the function using gerandchars.functionName()

How to generate strings ?

gerandchars.randStr(length, size [optional]);
//variable 1 is length to determine the length of a string that can be generated
//variable 2 is size you can choose between (high) or (low) if you don't fill it in it doesn't matter then the size will use the default size

//Example:
gerandchars.randStr(10); //NyWuKARIry

gerandchars.randStr(15, 'high'); //ORPSJIFCIZECEQH

gerandchars.randStr(13, 'low');  //ksvggkwmqycqm

How do you generate numbers ?

gerandchars.randNum(length);
//Function (randNum) requires 1 value, that's (length)

gerandchars.randNum(20); //64158543996528949596

How to generate a combination of strings and numbers ?

gerandchars.randStrNum(length, size [optional]);

//variable 1 is length to determine the length of a string that can be generated
//variable 2 is size you can choose between (high) or (low) if you don't fill it in it doesn't matter then the size will use the default size

gerandchars.randStrNum(20); //MDrCZq66oEvVhcoavXOh

gerandchars.randStrNum(9, 'high'); //F7TOGXSXF

gerandchars.randStrNum(5, 'low'); //t3meh

How to generate password ?

gerandchars.randPasswd(length);
//Function (randNum) requires 1 value, that's (length)

gerandchars.randPasswd(18); //(TtzZzyLSBw!HA%6(Q

How to generate random boolean ?

gerandchars.randBool();
//This will return a value of false or true

How to generate color randomly ?

Yes, you can generate colors randomly. HEX, RGB and HSL

gerandchars.randColor(type, opacity [optional]);
//You can enter 2 variables. type and opacity [optional]
//if you don't fill in [opacity] then the value will be generated randomly but if you fill in the string 'normal' then the value is [1] or default and if you fill in [opacity] with a numeric value [example: 0.195, 0.5, 0.9] then this value will be used

gerandchars.randColor('hex');
//#3afd1598

gerandchars.randColor('hex', 'normal');
//#2bb1bcff

gerandchars.randColor('hex', 0.6);
//#1bfcff99

//This applies to all type
//hex
//rgb
//hsl

How to generate emote ?

gerandchars.randEmote(type, length);

//Example

gerandchars.randEmote('face', 5);
//😀😁😂😃😄

gerandchars.randEmote('all', 4);
//😽👻👽✍

//List types
  //face
  //facecat
  //hand
  //clock
  //cloud
  //animal
  //month
  //number
  //countryflag
  //all

List

| Function | Description | | :--------------------- | :----------------------------------------------- | | randStr(length, size [optional]) | Generate String randomly | | randNum(length) | Generate numbers randomly | | randStrNum(length, size [optional]) | Generate strings and numbers randomly | | randPasswd(length) | Generate passwords randomly using a combination of strings, numbers and symbols | | randBool() | Generate boolean randomly | | randColor(type, opacity [optional]) | Generate colors randomly with various type | | randEmote(type, length) | Generate emote randomly with various type |