Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/idgen

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/idgen - npm Package Compare versions

Comparing version 0.2.23 to 0.2.24

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.2.24](https://github.com/thi-ng/umbrella/compare/@thi.ng/idgen@0.2.23...@thi.ng/idgen@0.2.24) (2020-10-19)
**Note:** Version bump only for package @thi.ng/idgen
## [0.2.23](https://github.com/thi-ng/umbrella/compare/@thi.ng/idgen@0.2.22...@thi.ng/idgen@0.2.23) (2020-09-22)

@@ -8,0 +16,0 @@

@@ -24,9 +24,36 @@ import { Event, IClear, INotify, Listener } from "@thi.ng/api";

set capacity(newCap: number);
/**
* Number of available IDs.
*/
get available(): number;
/**
* Number of used IDs.
*/
get used(): number;
/**
* Next available free ID.
*/
get freeID(): number;
[Symbol.iterator](): Generator<number, void, unknown>;
/**
* Frees all existing IDs and resets counter to zero.
*/
clear(): void;
/**
* Returns next available ID or throws error (assertion) if no further IDs
* are currently available.
*/
next(): number;
/**
* Marks given ID as available again and increases its version (if
* versioning is enabled).
*
* @param id
*/
free(id: number): boolean;
/**
* Returns true iff the given ID is valid and currently used.
*
* @param id
*/
has(id: number): boolean;

@@ -33,0 +60,0 @@ /** {@inheritDoc @thi.ng/api#INotify.addListener} */

@@ -47,8 +47,17 @@ import { __decorate } from "tslib";

}
/**
* Number of available IDs.
*/
get available() {
return this._capacity - this.num - this.start;
}
/**
* Number of used IDs.
*/
get used() {
return this.num;
}
/**
* Next available free ID.
*/
get freeID() {

@@ -64,2 +73,5 @@ return this._freeID;

}
/**
* Frees all existing IDs and resets counter to zero.
*/
clear() {

@@ -71,2 +83,6 @@ this.ids.length = 0;

}
/**
* Returns next available ID or throws error (assertion) if no further IDs
* are currently available.
*/
next() {

@@ -89,2 +105,8 @@ let id;

}
/**
* Marks given ID as available again and increases its version (if
* versioning is enabled).
*
* @param id
*/
free(id) {

@@ -99,2 +121,7 @@ if (!this.has(id))

}
/**
* Returns true iff the given ID is valid and currently used.
*
* @param id
*/
has(id) {

@@ -101,0 +128,0 @@ const rawID = this.id(id);

4

package.json
{
"name": "@thi.ng/idgen",
"version": "0.2.23",
"version": "0.2.24",
"description": "Generator of opaque numeric identifiers with optional support for ID versioning and efficient re-use",

@@ -75,3 +75,3 @@ "module": "./index.js",

},
"gitHead": "130dff672b56f789205177c2243169d33d479948"
"gitHead": "fddd3584c295648598109dab9b52b1f6bd6a1a18"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc