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

fast-reusable-id

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-reusable-id

fast reusable unique integer ids

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
3
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

fast reusable sequential integer ids

var FastRusableId = require('fast-reusable-id');

var start_id = 100; //all ids will start at 100
var max_id = 1000; //will throw error when you get id over 1000, defaults to 100000
var force_recycle = false; //will force to use released ids before reaching the max possible id, otherwise will use all possible ids up to max and then go through the pool of released ids and use them until it is empty.
var optional_typed_array = undefined // defaults to Uint32Array


var my_id_pool = new FastReusableId
//or pass with optional parameters
var my_id_pool = new FastReusableId(start_id,max_id,force_recycle,optional_typed_array); //pool to get ids from


var unique_id = my_id_pool.get() //get a fresh unique id
my_id_pool.release(unique_id) //im done with this id, release it into the pool to be used later

Keywords

id

FAQs

Package last updated on 17 Jul 2018

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