3.0.0 • Published 2 years ago
pertyid v3.0.0
pertyid
Generate unique, pretty base64 IDs suitable for a url bar.
How
pertyid(length?: number)
- Provide a
lengthargument 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-d9NjGJUkzwContribute
- Fork it
- Install it (
npm i) - Improve it
- Test it (
npm test) - Pull request it