1.0.3 • Published 2 years ago

@j2.trappy/random-keys v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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;