New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

job-id

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

job-id

generates unique numeric ids that are freeable

latest
npmnpm
Version
1.0.3
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

job-id.js

This module generates very short numeric IDs similar to how McDonalds assign numbers to their customers in queue.

install

npm install job-id

usage example

const ID = require("job-id");

ID.get();//returns "0"
ID.get();//returns "1"
ID.get();//returns "2"
ID.get();//returns "3"
ID.free("2");
ID.get();//returns "2"
ID.get();//returns "4"
ID.free("5");//warning: the id given is not used (5)

use cases

  • process numbering (delivery ID, rendering job naming etc)
  • queue numbering (similar to how McDolalds assigns numbers to customers)

Efficiency and Complexity

The get and free operations should be done in O(1) time since this module uses hash tables internally The memory will be O(n) where n is the maximum value of the numeric ID.

Keywords

id

FAQs

Package last updated on 31 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts