standardid

1.0.3 • Public • Published

StandardID Build Status

Generate IDs using the same format

This can be useful if you have user facing IDs that you want to be consitently formatted

Install

$ npm install standardid

Usage

const standardID  = require('standardid') // Require the module
 
// Create a new generator
// This will generator an ID of 3 uppercase alphabets followed by 3 digits
let generator = new standardID("AAA000");
 
// Generate a new ID
let newID = generator.generate();
 
// Set blueprint after generator is created
generator.blueprint = "aaaa";
newID = generator.generate();
 
// Placeing a ! will now select from the given string
generator.specifiers["!"] = ".!><?";
generator.blueprint = "!!!";
newID = generator.generate();
 

By default the specifiers are:

  "A":"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "a":"abcdefghijklmnopqrstuvwxyz",
  "0":"0123456789"
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    1
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i standardid

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

43 kB

Total Files

8

Last publish

Collaborators

  • gavinhenderson