Skip to content
/ zid Public

Generate random strings made up of [A-Za-z0-9] that are also URL compatible.

Notifications You must be signed in to change notification settings

chilts/zid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zid

Build Status

NPM

Generate random strings made up of [A-Za-z0-9] that are also URL compatible. Only good package name of '?id' left.

You choose the length. No underscore, no dash, no slash or backslash, indeed no other chars.

Synopsis

var zid = require('zid')

console.log(zid(6))
// -> 'fA8ljv'

console.log(zid(12))
// -> 'vy9gDZwKJmdK'

console.log(zid(0))
// -> throws

console.log(zid(-1))
// -> throws

console.log(zid())
// -> throws

console.log(zid('hello'))
// -> throws

Options

lookalikes

You can also exclude lookalike chars such as OISZbl by using { lookalikes: false }:

console.log(zid({ lookalikes: false }))
// -> returns an ID using these chars only:
// -> ABCDEFGHJKLMNPQRTUVWXYacdefghijkmnopqrstuvwxyz0123456789
// -> i.e. no OISZbl

AUTHOR

Written by Andrew Chilton:

License

MIT

(Ends)

About

Generate random strings made up of [A-Za-z0-9] that are also URL compatible.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published