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 = ; console; // UIVfjWVjN1UjyhMepVXPtcnVO9yi7uENJULhhbQMxpot2o2rP6console; // ejcWWx3coeconsole;console
API
string
randing(length, [config]) ⇒ Generate a random string (token)
Kind: global function
Returns: string
- - A random string of size length
Param | Type | Default | Description |
---|---|---|---|
length | number |
50 |
Length (in character) of the returned string |
[config] | object |
Configuration for the token generation | |
[config.lowercase] | boolean |
true |
Allow lowercase letters in the token |
[config.uppercase] | boolean |
true |
Allow uppercase letters in the token |
[config.figures] | boolean |
true |
Allow figures in the token |
[config.special] | boolean |
false |
Allow special characters in the token |
[config.alphabet] | string |
A string of characters to generate the random token from |
Credit
Created by Corentin Thomasset.