1.0.1 • Published 5 years ago

randing v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Random + String = Randing. Easily generate configurable random string and token

Installation

Easy installation using yarn or npm:

yarn add randing
  # or
npm install randing --save

Usage

const randing = require('randing');

console.log(randing()); 	// UIVfjWVjN1UjyhMepVXPtcnVO9yi7uENJULhhbQMxpot2o2rP6
console.log(randing(10));	// ejcWWx3coe
console.log(randing(60, {
    special:true,
    uppercase:false,		// n-*sh[]b@q?le<p>||p<kh}ua}:d+r|eq?t}!.}.gl@hkgfad|t{.@:z=ujq
    figures:false,
}));
console.log(randing(60, {
    alphabet:'azerty',		// teeerrrtezezytyytarz
}))

API

randing(length, config) ⇒ string

Generate a random string (token)

Kind: global function
Returns: string - - A random string of size length

ParamTypeDefaultDescription
lengthnumber50Length (in character) of the returned string
configobjectConfiguration for the token generation
config.lowercasebooleantrueAllow lowercase letters in the token
config.uppercasebooleantrueAllow uppercase letters in the token
config.figuresbooleantrueAllow figures in the token
config.specialbooleanfalseAllow special characters in the token
config.alphabetstringA string of characters to generate the random token from

Credit

Created by Corentin Thomasset.

1.0.1

5 years ago

1.0.0

5 years ago