random-chars

1.0.8 • Public • Published

random-chars

A small JavaScript library for generating random symbols

  • All browsers are supported
  • No dependencies

Installation

<script src="/path/to/random-chars.js"></script>

npm

npm i random-chars --save

var randomChars = require('random-chars');

Usage

randomChars.get();
/* Result: 95ejI8y5TPG8gR5c */
 
randomChars.get(3); //lenght (default: 16)
/* Result: zVx */
 
randomChars.get(16, 'haha'); //lenght and custom chars
/* Result: aaaaaaahhhhahahh */
 
randomChars.get({
  amount: 3 //lenght (default: 16)
});
/* Result: uIE */
 
randomChars.get({
  chars: 'haha' //custom chars (default: _defaultChars)
});
/* Result: ahaaahahhaaaaaha */
 
randomChars.get({
  amount: 36, //lenght (default: 16)
  use: {
    digits: false //digits from default chars (default: true)
  }
});
/* Result: NqJTlKgoWeWSwGiNGfqstJqyOLiscrXpjsDh */
 
randomChars.get({
  amount: 36, //lenght (default: 16)
  use: {
    lower: false //lowercase letters from default chars (default: true)
  }
});
/* Result: RMHGNDC3EO1CQYFH9MAYO52U3NYH2KUTPHMT */
 
randomChars.get({
  amount: 36, //lenght (default: 16)
  use: {
    upper: false //uppercase letters from default chars (default: true)
  }
});
/* Result: mnroj1095flbyplmh4fo6r5p4tpbbbt1mdt4 */

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.8
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.8
    3

Package Sidebar

Install

npm i random-chars

Weekly Downloads

3

Version

1.0.8

License

ISC

Last publish

Collaborators

  • fl3nkey