@sealsystems/short-id

    0.2.0 • Public • Published

    @sealsystems/short-id

    CircleCI AppVeyor

    Create a short human readable id of type string. This is done by concatenating two hash values. The first hash value is a static prefix build of the current data center name determined via @sealsystems/consul module. The second hash is built of a counter read from MongoDB by the @sealsystems/counter-storage module.

    Installation

    $ npm install @sealsystems/short-id

    Quick start

    First you need to integrate @sealsystems/short-id into your application:

    const shortId = require('@sealsystems/short-id');

    Get a handler object

    Use the required function to get a short id handler. As parameter of shortId provide an options object which has to contain already connected @sealsystems/consul and @sealsystems/counter-storage objects as properties:

    const shortIdHandler = await shortId({ consul, counterStorage });

    Get ids

    Call the handler's next function for each id you want:

    const id = await shortIdHandler.next();

    Running the build

    To build this module use roboter.

    $ bot

    Keywords

    none

    Install

    npm i @sealsystems/short-id

    DownloadsWeekly Downloads

    13

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    7.44 kB

    Total Files

    8

    Last publish

    Collaborators

    • gel
    • comgit
    • seal-mt
    • michaelscherer-seal