@compassdigital/id

Compass Digital IDs

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
04Jul 23, 2021Sep 20, 2017Minified + gzip package size for @compassdigital/id in KB

Readme

Compass Digital ID

Creates ids for use in the Compass Digital platform. Decodes ids to reveal the meta-data within.

Requirements

  • node.js 6+

Installation

npm install @compassdigital/id

Usage

const ID = require("@compassdigital/id");

// or use ES6 module import syntax
import ID from "@compassdigital/id";

var new_id = ID({
    service: "menu",
    provider: "Acme XYX",
    type: "item",
    id: "abc1234"
});
// lBprpeED47ILDZBwAYB4iwy0D8Ne55INALa576e9iKX4

var decoded = ID(new_id);
/*
{ 
    service: 'menu',
    provider: 'Acme XYX',
    type: 'item',
    id: 'abc1234' 
}
*/

// Convenience method
new_id = ID("menu", "Acme XYX", "item", "abc1234");
// lBprpeED47ILDZBwAYB4iwy0D8Ne55INALa576e9iKX4

Testing

npm install mocha -g # if you don't have it installed already
npm test

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.