pertyid
v3.0.0
Published
Generate unique, pretty base64 IDs suitable for a url bar.
Downloads
9
Readme
pertyid
Generate unique, pretty base64 IDs suitable for a url bar.
How
pertyid(length?: number)
- Provide a
length
argument to generate an ID of a given length.
Generate
const pertyid = require('pertyid');
import pertyid from 'pertyid'
/* generates a 10 digit ID */
pertyid() // sW1PHpPhKw
/* generates a 21 digit ID */
pertyid(21) // H0HAi5f3kbTTsAVO9oI1h
/* generate a 10 digit ID with prefix */
const id = `u-${pertyid()}`
console.log(id) // u-d9NjGJUkzw
Contribute
- Fork it
- Install it (
npm i
) - Improve it
- Test it (
npm test
) - Pull request it