Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.
/ hashzeus Public archive

5KB solution for generating unique event Ids

License

Notifications You must be signed in to change notification settings

Jithinqw/hashzeus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashzeus

Node.js CI npm GitHub npm collaborators

Generates globally unique eventId based on microservices on a network. This is created as an alternative for Javascript timestamps for identifying service events.

Installation

npm install hashzeus --save

Usage

    var hashZeus = require('hashzeus');
    var demo = new hashZeus()
    console.log(demo.generateHash('zerodha'));
    // zerodha-6dylVZFUl4cP3fH6bKRe.G
    console.log(demo.generateHash('byjus'));
    // byjus-4SFUv0vu06psuKOUYiw18T
    var demo1 = new hashZeus();
    console.log(demo1.generateHash('byjus')); 
    // generates completely different Id from a differnt object.
    // byjus-3s4REK77l2Fsh2hE8EIUGT

    var demo2 = new hashZeus();
    id1 = demo2.generateHash();
    // ..........37qqNkj4E24ulWyeuWxpZh
    id2 = demo2.generateHash();
    // ..........77qqNkj4E24ulWyeuWxpZh
    assert(id1 < id2)
    //true

API

  • generateHash(serviceName?: string) - Optional service name

About

5KB solution for generating unique event Ids

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published