Skip to content

speakeasyjs/xid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human-tolerant ID generator for NodeJS and the browser

xid uses the URL-friendly Crockford Base32 encoding with CRC-8 checksum to generate random identifiers that are tolerant to inaccurate human inputs.

Install

$ npm install --save xid

Usage

var xid = require("xid");
var id = xid.generateId();

// do something with generated ID...

// validate user input
try {
  xid.validate(id);
} catch (err) {
  // id is invalid
}

// normalize user input
try {
  id = xid.normalize(id);
} catch (err) {
  // id is invalid
}

License

Apache 2.0

About

Human-tolerant ID generator for NodeJS and the browser

Resources

License

Stars

Watchers

Forks

Packages

No packages published