1.0.0 • Published 6 years ago
randomizr v1.0.0
Randomizr
Random string generator
Install
npm install randomizrconst randomizr = require('randomizr');
let hash = randomizr();Methods
randomizr()
Generates a random sha256 hash
randomizr()randomizr.range([Number: min], [Number: max])
Generate a random number between the min - max range
randomizr.range(0, 99)randomizr.generate([Number: length], [Object: properties])
Generates a random string based on your preferences
Arguments
| Arguments | Description |
|---|---|
length | (Optional) The string length you want to generate [ default: 64 ] |
properties | (Optional) Custom properties |
properties
type- set character options: [ default: alphanumeric ]alpha- alphabet onlynumeric- numbers only
add- add custom characterscustom- use custom characters onlycamelCase- randomize lower or upper case for alphabets
Examples
256 alphanumeric characters
randomizr.generate(256)32 characters, alphanumeric + camel-case
randomizr.generate(32, {
camelCase: true
})128 characters, numbers only
randomizr.generate(128, {
type: 'numeric'
})16 characters, 1 or 0
randomizr.generate(16, {
custom: '10'
})16 characters, add custom characters
randomizr.generate(16, {
add: '#@!$%'
})16 characters, only these custom characters
randomizr.generate(16, {
custom: '$-<>?:;'
})