rand-id-generator

1.0.1 • Public • Published

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'

Dependents (0)

Package Sidebar

Install

npm i rand-id-generator

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

82.6 kB

Total Files

24

Last publish

Collaborators

  • lukasz.okuniewicz