@j2.trappy/random-keys
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Random keys

How to use

var random_keys_function = require("random-keys").default;

// Returns a random string, example : SWTNNbrI0oOn
console.log(random_keys_function.default("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")); // Make sure you don't do this: instead of using a string use a array -> don't do this, it can result in non-wanted results 

Options -> it can be an object or a string (directly)

onlyUpperCase: boolean - If the result should be upper case onlyLowerCase: boolean - If the result should be in lower case length: number - The length of the key chars: string[] - The chars that the function can use to create a random key

Examples

var random_keys_function = require("random-keys").default;

console.log(random_keys_function.default({ 
    keyLength: 4,
    chars: ["1", "2", "3","4"]
 })) // 3123;
var random_keys_function = require("random-keys").default;

console.log(random_keys_function.default({ 
    keyLength: 4,
    chars: ["1", "2", "3","4"]
 })) // 2DA3;

Readme

Keywords

Package Sidebar

Install

npm i @j2.trappy/random-keys

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

5.19 kB

Total Files

9

Last publish

Collaborators

  • j2.trappy