rand-id-generator
v1.0.1
Published
Random string generator
Downloads
4
Readme
RandIdGenerator by @lukasz-okuniewicz
Random string generator.
How to use:
npm install rand-id-generator
then:
const randIdGenerator = require('rand-id-generator')
// or
import randIdGenerator from 'rand-id-generator'
// Default length is 10
randIdGenerator() // '>/3(:WyQsK'
// First parameter it takes is length of the random string
randIdGenerator(3) // ':X2'
randIdGenerator(24) // 'FcpBgn{r(njFt0!N9#pj*PJN'
// Second parameter are options (default all of them are true)
const options = {
numbers: false,
lowerCase: false,
upperCase: true,
special: false
}
randIdGenerator(5, options) // 'AJDOP'
// You can pass only those which you want to be true
const options = {
lowerCase: true
}
randIdGenerator(5, options) // 'otfmw'
const options = {
numbers: true,
lowerCase: true
}
randIdGenerator(5, options) // 'e14op'