Skip to content

Commit

Permalink
Merge branch 'frozen-improvements' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
SalvatorePreviti committed Feb 3, 2023
2 parents ef29be5 + 210e746 commit 12901a1
Show file tree
Hide file tree
Showing 6 changed files with 343 additions and 212 deletions.
39 changes: 25 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export enum DeserializationFormat {
portable = "portable",

/**
* Non portable C/C++ frozen format. Can be larger than the other formats.
* Non portable C/C++ frozen format.
* Is considered unsafe and unstable because the format might change at any new version.
* Can be useful for temporary storage or for sending data over the network between similar machines.
* If the content is corrupted when loaded or the buffer is modified when a frozen view is create, the behavior is undefined!
Expand All @@ -142,7 +142,7 @@ export enum DeserializationFormat {
unsafe_frozen_croaring = "unsafe_frozen_croaring",

/**
* Portable version of the frozen view, compatible with Go and Java. Can be larger than the other formats.
* Portable version of the frozen view, compatible with Go and Java.
* Is considered unsafe and unstable because the format might change at any new version.
* Can be useful for temporary storage or for sending data over the network between similar machines.
* If the content is corrupted when loaded or the buffer is modified when a frozen view is create, the behavior is undefined!
Expand Down Expand Up @@ -1162,6 +1162,16 @@ export interface RoaringBitmap32 extends ReadonlyRoaringBitmap32, Set<number> {
* @memberof RoaringBitmap32
*/
freeze(): this;

/**
* A readonly view on this bitmap.
* It returns always the same instance.
* Can return this if this bitmap is fully hard frozen.
* The bitmap will contain the same data, and if the first bitmap is modified
* the readonlyView bitmap one will be modified too.
* The readonlyView bitmap is readonly, so it is not possible to modify it.
*/
asReadonlyView(): ReadonlyRoaringBitmap32;
}

/**
Expand Down Expand Up @@ -1279,18 +1289,7 @@ export class RoaringBitmap32 {
public static get PackageVersion(): string;

/**
* Property. True if the bitmap is read-only.
* A read-only bitmap cannot be modified, every operation will throw an error.
* You can freeze a bitmap using the freeze() method.
* A bitmap cannot be unfrozen.
*
* @type {boolean}
* @memberof RoaringBitmap32
*/
public readonly isFrozen: boolean;

/**
* Creates an instance of RoaringBitmap32.
* Creates an instance of RoaringBitmap32, or copies the given bitmap.
*
* Is faster to pass a Uint32Array instance instead of an array or an iterable.
*
Expand All @@ -1301,6 +1300,18 @@ export class RoaringBitmap32 {
*/
public constructor(values?: Iterable<number>);

/**
* Creates a new frozen readonly view of the given bitmap.
* The bitmap will contain the same data, and if the first bitmap is modified
* the second one will be modified too.
* The created bitmap is frozen, so it is not possible to modify it.
*
* @param {RoaringBitmap32} roaringBitmap32 The source RoaringBitmap32.
* @param {"frozen"} frozen Must be "frozen"
* @memberof RoaringBitmap32Iterator
*/
public constructor(roaringBitmap32: ReadonlyRoaringBitmap32, frozen: "frozen");

/**
* Creates an instance of RoaringBitmap32 from the given Iterable.
*
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = roaring;

const { defineProperty } = Reflect;

defineProperty(roaring, "__esModule", { value: true });
defineProperty(roaring, "__esModule", { value: true, configurable: true });

const { RoaringBitmap32, RoaringBitmap32BufferedIterator } = roaring;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roaring",
"version": "1.4.0",
"version": "1.4.1",
"private": false,
"description": "CRoaring official port for NodeJS",
"keywords": [
Expand Down
Loading

0 comments on commit 12901a1

Please sign in to comment.