New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

structurae

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

structurae - npm Package Compare versions

Comparing version 4.0.0-pre.10 to 4.0.0-pre.11

dict-view.d.ts

59

adjacency-list.js

@@ -1,32 +0,10 @@

/**
* Creates an Adjacency List class extending a given TypedArray class.
*
* @param Base a TypedArray class to extend
*/
export function AdjacencyListMixin(Base) {
/**
* Implements the Adjacency List data structure for weighted directed graphs.
*/
class AdjacencyList extends Base {
// deno-lint-ignore no-explicit-any
static directed = true;
static weighted = true;
vertices = 2;
edges = 4;
empty = undefined;
constructor(...args) {
super(...args);
Object.defineProperty(this, "vertices", {
enumerable: true,
configurable: true,
writable: true,
value: 2
});
Object.defineProperty(this, "edges", {
enumerable: true,
configurable: true,
writable: true,
value: 4
});
Object.defineProperty(this, "empty", {
enumerable: true,
configurable: true,
writable: true,
value: undefined
});
[this.vertices, this.edges] = AdjacencyList.getDimensions(this);

@@ -45,5 +23,2 @@ }

}
/*
* Returns the dimensions, vertices and maximum edge count, of an existing AdjacencyList
*/
static getDimensions(list) {

@@ -60,11 +35,8 @@ let vertices = 0;

}
// TODO document RangeError
addEdge(x, y, weight) {
if (this.hasEdge(x, y))
return this;
// the list is full
if (this.isFull())
throw new RangeError("The list is full.");
const { vertices } = this;
// shift values
for (let i = this[vertices]; i > this[x]; i -= 2) {

@@ -78,6 +50,4 @@ [this[i], this[i + 1], this[i - 1], this[i - 2]] = [

}
// set edge
this[this[x]] = y;
this[this[x] + 1] = weight;
// update offsets
for (let i = x + 1; i <= vertices; i++) {

@@ -91,3 +61,2 @@ this[i] += 2;

const nextOffset = this[x + 1];
// no out edges from x
if (offset === nextOffset)

@@ -132,3 +101,2 @@ return NaN;

const nextOffset = this[x + 1];
// no out edges from x
if (offset === nextOffset)

@@ -143,6 +111,4 @@ return this;

}
// there is no such edge
if (!edgeIndex)
return this;
// shift value
for (let i = edgeIndex; i < this[this.vertices]; i += 2) {

@@ -152,3 +118,2 @@ this[i] = this[i + 2];

}
// update offsets
for (let i = x + 1; i <= this.vertices; i++) {

@@ -166,17 +131,5 @@ this[i] -= 2;

}
Object.defineProperty(AdjacencyList, "directed", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
Object.defineProperty(AdjacencyList, "weighted", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
return AdjacencyList;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRqYWNlbmN5LWxpc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhZGphY2VuY3ktbGlzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZQSxNQUFNLFVBQVUsa0JBQWtCLENBQ2hDLElBQU87SUFRUCxNQUFNLGFBQWMsU0FBUSxJQUFJO1FBQzlCLE1BQU0sQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFDO1FBQ3ZCLE1BQU0sQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFDO1FBQ3ZCLFFBQVEsR0FBRyxDQUFDLENBQUM7UUFDYixLQUFLLEdBQUcsQ0FBQyxDQUFDO1FBQ1YsS0FBSyxHQUFHLFNBQVMsQ0FBQztRQUdsQixZQUFZLEdBQUcsSUFBVztZQUN4QixLQUFLLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQztZQUNmLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsYUFBYSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNsRSxDQUFDO1FBRUQsTUFBTSxLQUFLLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQztZQUN6QixPQUFPLElBQUksQ0FBQztRQUNkLENBQUM7UUFFRCxNQUFNLENBQUMsTUFBTSxDQUFDLF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ICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIC8vIHRoZXJlIGlzIG5vIHN1Y2ggZWRnZVxuICAgICAgaWYgKCFlZGdlSW5kZXgpIHJldHVybiB0aGlzO1xuICAgICAgLy8gc2hpZnQgdmFsdWVcbiAgICAgIGZvciAobGV0IGkgPSBlZGdlSW5kZXg7IGkgPCB0aGlzW3RoaXMudmVydGljZXNdOyBpICs9IDIpIHtcbiAgICAgICAgdGhpc1tpXSA9IHRoaXNbaSArIDJdO1xuICAgICAgICB0aGlzW2kgKyAxXSA9IHRoaXNbaSArIDNdO1xuICAgICAgfVxuXG4gICAgICAvLyB1cGRhdGUgb2Zmc2V0c1xuICAgICAgZm9yIChsZXQgaSA9IHggKyAxOyBpIDw9IHRoaXMudmVydGljZXM7IGkrKykge1xuICAgICAgICB0aGlzW2ldIC09IDI7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzO1xuICAgIH1cblxuICAgIHNldE9mZnNldHMoKTogdm9pZCB7XG4gICAgICBjb25zdCBsYXN0RWxlbWVudCA9IHRoaXMudmVydGljZXMgKyAxO1xuICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsYXN0RWxlbWVudDsgaSsrKSB7XG4gICAgICAgIHRoaXNbaV0gPSBsYXN0RWxlbWVudDtcbiAgICAgIH1cbiAgICB9XG4gIH1cblxuICByZXR1cm4gQWRqYWNlbmN5TGlzdDtcbn1cbiJdfQ==
//# sourceMappingURL=adjacency-list.js.map
import { getLog2 } from "./utilities.js";
/**
* Implements the Adjacency Matrix structure for unweighted directed graphs.
*/
export class AdjacencyMatrixUnweightedDirected extends Uint32Array {
constructor() {
super(...arguments);
Object.defineProperty(this, "empty", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
Object.defineProperty(this, "_size", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
static directed = true;
static weighted = false;
empty = 0;
static get [Symbol.species]() {
return Uint32Array;
}
_size = 0;
get size() {

@@ -97,15 +83,3 @@ return this._size || ((this._size = getLog2(this.vertices)), this._size);

}
Object.defineProperty(AdjacencyMatrixUnweightedDirected, "directed", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
Object.defineProperty(AdjacencyMatrixUnweightedDirected, "weighted", {
enumerable: true,
configurable: true,
writable: true,
value: false
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRqYWNlbmN5LW1hdHJpeC11bndlaWdodGVkLWRpcmVjdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYWRqYWNlbmN5LW1hdHJpeC11bndlaWdodGVkLWRpcmVjdGVkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1BLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUt6QyxNQUFNLE9BQU8saUNBQWtDLFNBQVEsV0FBVztJQUVoRSxNQUFNLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQztJQUN2QixNQUFNLENBQUMsUUFBUSxHQUFHLEtBQUssQ0FBQztJQUN4QixLQUFLLEdBQUcsQ0FBQyxDQUFDO0lBRVYsTUFBTSxLQUFLLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQztRQUN6QixPQUFPLFdBQVcsQ0FBQztJQUNyQixDQUFDO0lBRUQsS0FBSyxHQUFHLENBQUMsQ0FBQztJQUVWLElBQUksSUFBSTtRQUNOLE9BQU8sSUFBSSxDQUFDLEtBQUssSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQzNFLENBQUM7SUFFRCxJQUFJLFFBQVE7UUFDVixPQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO0lB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2UoaSwgdmVydGV4KSkgeWllbGQgaTtcbiAgICB9XG4gIH1cblxuICBpc0Z1bGwoKTogYm9vbGVhbiB7XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG5cbiAgKm91dEVkZ2VzKHZlcnRleDogbnVtYmVyKSB7XG4gICAgY29uc3QgeyB2ZXJ0aWNlcyB9ID0gdGhpcztcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IHZlcnRpY2VzOyBpKyspIHtcbiAgICAgIGlmICh0aGlzLmdldEVkZ2UodmVydGV4LCBpKSkgeWllbGQgaTtcbiAgICB9XG4gIH1cblxuICByZW1vdmVFZGdlKHg6IG51bWJlciwgeTogbnVtYmVyKTogdGhpcyB7XG4gICAgY29uc3QgW2J1Y2tldCwgcG9zaXRpb25dID0gdGhpcy5nZXRDb29yZGluYXRlcyh4LCB5KTtcbiAgICBpZiAoTnVtYmVyLmlzTmFOKGJ1Y2tldCkpIHJldHVybiB0aGlzO1xuICAgIHRoaXNbYnVja2V0XSA9IHRoaXNbYnVja2V0XSAmIH4oMSA8PCBwb3NpdGlvbik7XG4gICAgcmV0dXJuIHRoaXM7XG4gIH1cbn1cbiJdfQ==
//# sourceMappingURL=adjacency-matrix-unweighted-directed.js.map
import { AdjacencyMatrixUnweightedDirected } from "./adjacency-matrix-unweighted-directed.js";
/**
* Implements the Adjacency Matrix data structure for unweighted undirected graphs.
*/
export class AdjacencyMatrixUnweightedUndirected extends AdjacencyMatrixUnweightedDirected {
static directed = false;
static getLength(vertices) {

@@ -13,9 +11,3 @@ return (((vertices + 1) * vertices) >> 6) + 2;

}
Object.defineProperty(AdjacencyMatrixUnweightedUndirected, "directed", {
enumerable: true,
configurable: true,
writable: true,
value: false
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRqYWNlbmN5LW1hdHJpeC11bndlaWdodGVkLXVuZGlyZWN0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhZGphY2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BjbGFzcyBBZGphY2VuY3lNYXRyaXhVbndlaWdodGVkVW5kaXJlY3RlZFxuICBleHRlbmRzIEFkamFjZW5jeU1hdHJpeFVud2VpZ2h0ZWREaXJlY3RlZCB7XG4gIHN0YXRpYyBkaXJlY3RlZCA9IGZhbHNlO1xuICBzdGF0aWMgZ2V0TGVuZ3RoKHZlcnRpY2VzOiBudW1iZXIpOiBudW1iZXIge1xuICAgIHJldHVybiAoKCh2ZXJ0aWNlcyArIDEpICogdmVydGljZXMpID4+IDYpICsgMjtcbiAgfVxuICBnZXRJbmRleCh4OiBudW1iZXIsIHk6IG51bWJlcik6IG51bWJlciB7XG4gICAgcmV0dXJuIHggPj0geSA/IHkgKyAoKCh4ICsgMSkgKiB4KSA+PiAxKSA6IHggKyAoKCh5ICsgMSkgKiB5KSA+PiAxKTtcbiAgfVxufVxuIl19
//# sourceMappingURL=adjacency-matrix-unweighted-undirected.js.map

@@ -1,29 +0,10 @@

/**
* Creates an Adjacency Matrix class extending a given TypedArray class.
*
* @param Base a TypedArray class to extend
*/
export function AdjacencyMatrixWeightedDirectedMixin(Base) {
/**
* Implements Adjacency Matrix for weighted directed graphs.
*/
class AdjacencyMatrixWeightedDirected extends Base {
constructor() {
super(...arguments);
Object.defineProperty(this, "empty", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
Object.defineProperty(this, "_vertices", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
static directed = true;
static weighted = true;
empty = 0;
static get [Symbol.species]() {
return Base;
}
_vertices = 0;
get vertices() {

@@ -85,17 +66,5 @@ return (this._vertices ||

}
Object.defineProperty(AdjacencyMatrixWeightedDirected, "directed", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
Object.defineProperty(AdjacencyMatrixWeightedDirected, "weighted", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
return AdjacencyMatrixWeightedDirected;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRqYWNlbmN5L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iAgICB9XG5cbiAgICByZW1vdmVFZGdlKHg6IG51bWJlciwgeTogbnVtYmVyKTogdGhpcyB7XG4gICAgICB0aGlzW3RoaXMuZ2V0SW5kZXgoeCwgeSldID0gdGhpcy5lbXB0eTtcbiAgICAgIHJldHVybiB0aGlzO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBBZGphY2VuY3lNYXRyaXhXZWlnaHRlZERpcmVjdGVkO1xufVxuIl19
//# sourceMappingURL=adjacency-matrix-weighted-directed.js.map
import { AdjacencyMatrixWeightedDirectedMixin } from "./adjacency-matrix-weighted-directed.js";
/**
* Creates an Adjacency Matrix class extending a given TypedArray class.
*
* @param Base a TypedArray class to extend
*/
export function AdjacencyMatrixWeightedUndirectedMixin(Base) {
/**
* Implements the Adjacency Matrix for weighted undirected graphs.
*/
class AdjacencyMatrixWeightedUndirected extends AdjacencyMatrixWeightedDirectedMixin(Base) {
static directed = false;
static getLength(vertices, _) {

@@ -22,16 +15,8 @@ return ((vertices + 1) * vertices) >> 1;

outEdges(vertex) {
// TODO: fix type casting
return this.inEdges(vertex);
}
}
Object.defineProperty(AdjacencyMatrixWeightedUndirected, "directed", {
enumerable: true,
configurable: true,
writable: true,
value: false
});
// TODO: fix type casting
return AdjacencyMatrixWeightedUndirected;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRqYWNlbmN5LW1hdHJpeC13ZWlnaHRlZC11bmRpcmVjdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYWRqYWNlbmN5LW1hdHJpeC13ZWlnaHRlZC11bmRpcmVjdGVkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBTy9GLE1BQU0sVUFBVSxzQ0FBc0MsQ0FFcEQsSUFBTztJQUlQLE1BQU0saUNBQ0osU0FBUSxvQ0FBb0MsQ0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yhsZW5ndGg6IG51bWJlcik6IG51bWJlciB7XG4gICAgICByZXR1cm4gKE1hdGguc3FydCgobGVuZ3RoIDw8IDMpICsgMSkgLSAxKSA+PiAxO1xuICAgIH1cblxuICAgIGdldEluZGV4KHg6IG51bWJlciwgeTogbnVtYmVyKTogbnVtYmVyIHtcbiAgICAgIHJldHVybiB4ID49IHkgPyB5ICsgKCgoeCArIDEpICogeCkgPj4gMSkgOiB4ICsgKCgoeSArIDEpICogeSkgPj4gMSk7XG4gICAgfVxuXG4gICAgb3V0RWRnZXModmVydGV4OiBudW1iZXIpIHtcbiAgICAgIC8vIFRPRE86IGZpeCB0eXBlIGNhc3RpbmdcbiAgICAgIHJldHVybiAodGhpcyBhcyB1bmtub3duIGFzIEFkamFjZW5jeVN0cnVjdHVyZSkuaW5FZGdlcyh2ZXJ0ZXgpO1xuICAgIH1cbiAgfVxuXG4gIC8vIFRPRE86IGZpeCB0eXBlIGNhc3RpbmdcbiAgcmV0dXJuIEFkamFjZW5jeU1hdHJpeFdlaWdodGVkVW5kaXJlY3RlZCBhcyB1bmtub3duIGFzIEFkamFjZW5jeVN0cnVjdHVyZUNvbnN0cnVjdG9yPFxuICAgIFVcbiAgPjtcbn1cbiJdfQ==
//# sourceMappingURL=adjacency-matrix-weighted-undirected.js.map

@@ -13,2 +13,3 @@ import type { ComplexView, ContainerView, PrimitiveView, ViewConstructor, ViewInstance } from "./view-types";

static getSize(length: number): number;
static indexOf<T>(value: T, view: DataView, startIndex?: number, startOffset?: number, length?: number): number;
[Symbol.iterator](): Generator<ViewInstance<T>>;

@@ -19,2 +20,3 @@ at(index: number): T;

getView(index: number): ViewInstance<T>;
indexOf(value: T, start?: number): number;
set(index: number, value: T): void;

@@ -21,0 +23,0 @@ setView(index: number, value: DataView): void;

export class ArrayView extends DataView {
static View;
static viewLength = 0;
static itemLength;
get size() {

@@ -27,2 +24,3 @@ return this.constructor.getSize(this.byteLength);

const written = max * itemLength;
// zero-out remaining bytes
let caret = written;

@@ -47,2 +45,15 @@ while (caret < length)

}
static indexOf(value, view, startIndex = 0, startOffset = 0, length = view.byteLength) {
const size = this.getSize(length);
const valueView = this.View.from(value);
outer: for (let i = startIndex; i < size; i++) {
const offset = startOffset + this.getOffset(i);
for (let j = 0; j < valueView.byteLength; j++) {
if (valueView.getUint8(j) !== view.getUint8(offset + j))
continue outer;
}
return i;
}
return -1;
}
*[Symbol.iterator]() {

@@ -72,2 +83,5 @@ const { size } = this;

}
indexOf(value, start = 0) {
return this.constructor.indexOf(value, this, start, 0, this.byteLength);
}
set(index, value) {

@@ -86,3 +100,9 @@ const constructor = this.constructor;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJyYXktdmlldy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFycmF5LXZpZXcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUEsTUFBTSxPQUFPLFNBQWEsU0FBUSxRQUFRO0lBQ3hDLE1BQU0sQ0FBQyxJQUFJLENBR1Q7SUFDRixNQUFNLENBQUMsVUFBVSxHQUFHLENBQUMsQ0FBQztJQUN0QixNQUFNLENBQUMsVUFBVSxDQUFTO0lBRTFCLElBQUksSUFBSTtRQUNOLE9BQVEsSUFBSSxDQUFDLFdBQWdDLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUN6RSxDQUFDO0lBRUQsTUFBTSxDQUFDLE1BQU0sQ0FDWCxJQUFjLEVBQ2QsS0FBSyxHQUFHLENBQUMsRUFDVCxNQUFNLEdBQUcsSUFBSSxDQUFDLFVBQVU7UUFFeEIsTUFBTSxFQUFFLElBQUksRUFBRSxVQUFVLEVBQUUsR0FBRyxJQUFJLENBQUM7UUFDbEMsTUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUNsQyxNQUFNLEtBQUssR0FBRyxJQUF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mNvbnN0cnVjdG9yIGFzIHR5cGVvZiBBcnJheVZpZXc7XG4gICAgbmV3IFVpbnQ4QXJyYXkoXG4gICAgICB0aGlzLmJ1ZmZlcixcbiAgICAgIHRoaXMuYnl0ZU9mZnNldCArIGNvbnN0cnVjdG9yLmdldE9mZnNldChpbmRleCksXG4gICAgICBjb25zdHJ1Y3Rvci5pdGVtTGVuZ3RoLFxuICAgICkuc2V0KG5ldyBVaW50OEFycmF5KHZhbHVlLmJ1ZmZlciwgdmFsdWUuYnl0ZU9mZnNldCwgdmFsdWUuYnl0ZUxlbmd0aCkpO1xuICB9XG5cbiAgdG9KU09OKCk6IEFycmF5PFQ+IHtcbiAgICByZXR1cm4gKHRoaXMuY29uc3RydWN0b3IgYXMgdHlwZW9mIEFycmF5VmlldykuZGVjb2RlPFQ+KFxuICAgICAgdGhpcyxcbiAgICAgIDAsXG4gICAgICB0aGlzLmJ5dGVMZW5ndGgsXG4gICAgKTtcbiAgfVxufVxuIl19
Object.defineProperty(ArrayView, "viewLength", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
//# sourceMappingURL=array-view.js.map

@@ -7,9 +7,10 @@ import { getBitSize } from "./utilities.js";

class BigBitField {
static schema;
static fields;
static masks;
static offsets;
static mask;
static size;
value = ZERO;
constructor(data = ZERO) {
Object.defineProperty(this, "value", {
enumerable: true,
configurable: true,
writable: true,
value: ZERO
});
this.value = data instanceof BigBitField

@@ -126,21 +127,3 @@ ? data.valueOf()

}
/**
* Creates a BigBitField class with a given schema. BigBitField uses bigints as bitfields
* to store and operate on data using bitwise operations.
*
* @param schema the schema
* @returns the BigBitFieldClass
*
* @example
* const LargeField = BitFieldMixin({ width: 20, height: 20 });
* const largeField = new LargeField({ width: 1048576, height: 1048576 });
* largeField.value
* //=> 1099512676352n
* largeField.set('width', 1000).get('width')
* //=> 1000
* largeField.toObject()
* //=> { width: 1000, height: 1048576 }
*/
export function BigBitFieldMixin(schema) {
var _a;
const fields = Object.keys(schema);

@@ -159,43 +142,12 @@ const _schema = {};

}
return _a = class extends BigBitField {
},
Object.defineProperty(_a, "schema", {
enumerable: true,
configurable: true,
writable: true,
value: _schema
}),
Object.defineProperty(_a, "fields", {
enumerable: true,
configurable: true,
writable: true,
value: fields
}),
Object.defineProperty(_a, "masks", {
enumerable: true,
configurable: true,
writable: true,
value: masks
}),
Object.defineProperty(_a, "offsets", {
enumerable: true,
configurable: true,
writable: true,
value: offsets
}),
Object.defineProperty(_a, "size", {
enumerable: true,
configurable: true,
writable: true,
value: lastOffset
}),
Object.defineProperty(_a, "mask", {
enumerable: true,
configurable: true,
writable: true,
value: TWO << (BigInt(lastOffset) - ONE)
}),
_a;
return class extends BigBitField {
static schema = _schema;
static fields = fields;
static masks = masks;
static offsets = offsets;
static size = lastOffset;
static mask = TWO << (BigInt(lastOffset) - ONE);
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmlnLWJpdC1maWVsZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImJpZy1iaXQtZmllbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBTTVDLE1BQU0sUUFBUSxHQUFHLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUNwQyxNQUFNLElBQUksR0FBRyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDdkIsTUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3RCLE1BQU0sR0FBRyxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUV0QixNQUFNLFdBQVc7SUFFZixNQUFNLENBQUMsTUFBTSxDQUE4QjtJQUMzQyxNQUFNLENBQUMsTUFBTSxDQUFxQjtJQUNsQyxNQUFNLENBQUMsS0FBSyxDQUE4QjtJQUMxQyxNQUFN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XG4gIGZvciAobGV0IGkgPSAwOyBpIDwgZmllbGRzLmxlbmd0aDsgaSsrKSB7XG4gICAgY29uc3QgZmllbGQgPSBmaWVsZHNbaV07XG4gICAgY29uc3Qgc2l6ZSA9IEJpZ0ludChzY2hlbWFbZmllbGRdKTtcbiAgICBfc2NoZW1hW2ZpZWxkXSA9IHNpemU7XG4gICAgbWFza3NbZmllbGRdID0gKFRXTyA8PCAoc2l6ZSAtIE9ORSkpIC0gT05FO1xuICAgIG9mZnNldHNbZmllbGRdID0gbGFzdE9mZnNldDtcbiAgICBsYXN0T2Zmc2V0ICs9IHNpemU7XG4gIH1cblxuICByZXR1cm4gY2xhc3MgZXh0ZW5kcyBCaWdCaXRGaWVsZDxLPiB7XG4gICAgc3RhdGljIHNjaGVtYSA9IF9zY2hlbWE7XG4gICAgc3RhdGljIGZpZWxkcyA9IGZpZWxkcztcbiAgICBzdGF0aWMgbWFza3MgPSBtYXNrcztcbiAgICBzdGF0aWMgb2Zmc2V0cyA9IG9mZnNldHM7XG4gICAgc3RhdGljIHNpemUgPSBsYXN0T2Zmc2V0O1xuICAgIHN0YXRpYyBtYXNrID0gVFdPIDw8IChCaWdJbnQobGFzdE9mZnNldCkgLSBPTkUpO1xuICB9O1xufVxuIl19
//# sourceMappingURL=big-bit-field.js.map
import { getLog2 } from "./utilities.js";
/**
* Implements a grid or 2D matrix of bits.
*/
export class BinaryGrid extends Uint32Array {
constructor() {
super(...arguments);
Object.defineProperty(this, "size", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
size = 0;
static get [Symbol.species]() {
return Uint32Array;
}
/**
* Number of columns in the grid.
*/
get columns() {
return 1 << this.size;
}
/**
* Specifies the number of columns of the grid.
*/
set columns(columns) {
this.size = getLog2(columns);
}
/**
* Number of rows in the grid.
*/
get rows() {
return (this.length << 5) >> this.size;
}
/**
* Creates a binary grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return a new binary grid
*/
static create(rows, columns = 1) {

@@ -50,12 +23,5 @@ const offset = getLog2(columns);

}
/**
* Creates a new binary grid from an array of arrays representing rows and item value of the grid.
*
* @param arrays the array of arrays
* @return a new binary grid
*/
static fromArrays(arrays) {
const rows = arrays.length;
// find longest array to get the column size
let columns = arrays[0].length; // if !arrays[0].length
let columns = arrays[0].length;
for (let i = 0; i < rows; i++) {

@@ -65,6 +31,4 @@ if (arrays[i].length > columns)

}
// create grid of the required length
const grid = this.create(rows, columns);
grid.size = getLog2(columns);
// fill the grid with values from arrays
for (let i = 0; i < rows; i++) {

@@ -77,9 +41,2 @@ for (let j = 0; j < arrays[i].length; j++) {

}
/**
* Returns the length of the underlying TypedArray required to hold a grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return the required length
*/
static getLength(rows, columns = 1) {

@@ -93,9 +50,2 @@ return (rows << getLog2(columns)) >> 5;

}
/**
* Returns the index of an item holding the bit at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the item index
*/
getIndex(row, column = 1) {

@@ -105,9 +55,2 @@ const index = (row << this.size) + column;

}
/**
* Returns the bit at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the bit
*/
getValue(row, column) {

@@ -117,10 +60,2 @@ const [bucket, position] = this.getCoordinates(row, column);

}
/**
* Sets the bit at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @param value the bit
* @return the grid
*/
setValue(row, column, value = 1) {

@@ -131,7 +66,2 @@ const [bucket, position] = this.getCoordinates(row, column || 0);

}
/**
* Creates an array of arrays representing rows of the grid.
*
* @return an array of arrays
*/
toArrays() {

@@ -149,3 +79,3 @@ const { rows, columns } = this;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluYXJ5LWdyaWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJiaW5hcnktZ3JpZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQ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9uKSkgfCAodmFsdWUgPDwgcG9zaXRpb24pO1xuICAgIHJldHVybiB0aGlzO1xuICB9XG5cbiAgLyoqXG4gICAqIENyZWF0ZXMgYW4gYXJyYXkgb2YgYXJyYXlzIHJlcHJlc2VudGluZyByb3dzIG9mIHRoZSBncmlkLlxuICAgKlxuICAgKiBAcmV0dXJuIGFuIGFycmF5IG9mIGFycmF5c1xuICAgKi9cbiAgdG9BcnJheXMoKTogQXJyYXk8QXJyYXk8Qml0Pj4ge1xuICAgIGNvbnN0IHsgcm93cywgY29sdW1ucyB9ID0gdGhpcztcbiAgICBjb25zdCByZXN1bHQ6IEFycmF5PEFycmF5PEJpdD4+ID0gbmV3IEFycmF5KHJvd3MpO1xuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcm93czsgaSsrKSB7XG4gICAgICByZXN1bHRbaV0gPSBuZXcgQXJyYXkoY29sdW1ucyk7XG4gICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGNvbHVtbnM7IGorKykge1xuICAgICAgICByZXN1bHRbaV1bal0gPSB0aGlzLmdldFZhbHVlKGksIGopO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcmVzdWx0O1xuICB9XG59XG4iXX0=
//# sourceMappingURL=binary-grid.js.map

@@ -1,8 +0,2 @@

/**
* Extends Array to implement the Binary Heap data structure.
* // TODO (docs) document priority queue operations
* // todo add heapsort?
*/
export class BinaryHeap extends Array {
// deno-lint-ignore no-explicit-any
constructor(...args) {

@@ -15,9 +9,2 @@ super(...args);

}
/**
* The comparator function used by the heap.
*
* @param a first value to compare
* @param b second value to compare
* @return whether first value is less than the second
*/
static compare(a, b) {

@@ -31,32 +18,11 @@ return a < b;

}
/**
* Get left child index from parent index.
*
* @param index the parent index
* @return the index of the left child
*/
static getLeftIndex(index) {
return (index << 1) + 1;
}
/**
* Get left child index from parent index.
*
* @param index the child index
* @return the index of the parent
*/
static getParentIndex(index) {
return (index - 1) >> 1;
}
/**
* Get right child index from parent index.
*
* @param index the parent index
* @return the index of the right child
*/
static getRightIndex(index) {
return (index << 1) + 2;
}
/**
* Checks if a given collection is a valid binary heap.
*/
static isHeap(heap) {

@@ -72,21 +38,8 @@ for (let i = heap.length - 1; i > -1; i--) {

}
/**
* Creates a new BinaryHeap with a variable number of arguments,
* regardless of number or type of the arguments.
*
* @param elements the elements of which to create the heap
* @return the new BinaryHeap
*/
static of(...elements) {
return super.of(...elements).heapify();
}
/**
* Check whether the index is whithin the heap.
*/
has(index) {
return index >= 0 && index < this.length;
}
/**
* Restores the binary heap.
*/
heapify() {

@@ -98,26 +51,11 @@ for (let i = this.length >> 1; i >= 0; i--) {

}
/**
* Checks whether the array is a valid binary heap.
*/
isHeap() {
return this.constructor.isHeap(this);
}
/**
* Returns the left child of an element at a given index.
*/
left(index) {
return this[this.constructor.getLeftIndex(index)];
}
/**
* Returns the parent of an element at a given index.
*/
parent(index) {
return this[this.constructor.getParentIndex(index)];
}
/**
* Adds items to the heap.
*
* @param elements items to add
* @return new length of the heap
*/
push(...elements) {

@@ -130,8 +68,2 @@ for (let i = 0; i < elements.length; i++) {

}
/**
* Returns the first (min/max) element of the heap and replaces it with a given element.
*
* @param element the element to replace the first element of the heap
* @return the first element of the heap
*/
replace(element) {

@@ -143,13 +75,6 @@ const first = this[0];

}
/**
* Returns the right child of an element at a given index.
*/
right(index) {
return this[this.constructor.getRightIndex(index)];
}
/**
* Extracts the first element of the heap.
*/
shift() {
// extract min/max
if (this.length < 2)

@@ -194,10 +119,2 @@ return this.pop();

}
/**
* Changes elements of the heap.
*
* @param start starting index
* @param deleteCount the amount of elements to delete
* @param items elements to add
* @return the deleted elements
*/
splice(start, deleteCount, ...items) {

@@ -225,16 +142,5 @@ const deletedItems = deleteCount === undefined

}
/**
* Adds elements to the heap.
*
* @param items elements to add
* @return the new length of the heap
*/
unshift(...items) {
return this.push(...items);
}
/**
* Updates the position of an element inside the heap.
*
* @param index the index of the element to update
*/
update(index) {

@@ -253,3 +159,3 @@ const { compare, getLeftInd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hpcy5wdXNoKC4uLml0ZW1zKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBVcGRhdGVzIHRoZSBwb3NpdGlvbiBvZiBhbiBlbGVtZW50IGluc2lkZSB0aGUgaGVhcC5cbiAgICpcbiAgICogQHBhcmFtIGluZGV4IHRoZSBpbmRleCBvZiB0aGUgZWxlbWVudCB0byB1cGRhdGVcbiAgICovXG4gIHVwZGF0ZShpbmRleDogbnVtYmVyKTogdm9pZCB7XG4gICAgY29uc3QgeyBjb21wYXJlLCBnZXRMZWZ0SW5kZXggfSA9IHRoaXMuY29uc3RydWN0b3IgYXMgdHlwZW9mIEJpbmFyeUhlYXA7XG4gICAgY29uc3QgcGFyZW50ID0gdGhpcy5wYXJlbnQoaW5kZXgpO1xuICAgIGNvbnN0IGxlZnRJbmRleCA9IGdldExlZnRJbmRleChpbmRleCk7XG4gICAgaWYgKFxuICAgICAgdGhpcy5oYXMobGVmdEluZGV4KSAmJlxuICAgICAgKHBhcmVudCA9PT0gdW5kZWZpbmVkIHx8IGNvbXBhcmUocGFyZW50LCB0aGlzW2luZGV4XSkpXG4gICAgKSB7XG4gICAgICB0aGlzLnNpZnREb3duKGluZGV4KTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhpcy5zaWZ0VXAoaW5kZXgpO1xuICAgIH1cbiAgfVxufVxuIl19
//# sourceMappingURL=binary-heap.js.map
export class BinaryView extends DataView {
static viewLength = 0;
static decode(view, start = 0, length = view.byteLength) {

@@ -6,4 +7,5 @@ return new Uint8Array(view.buffer.slice(view.byteOffset + start, view.byteOffset + start + length));

static encode(value, view, start = 0, length) {
const valueLength = value.byteLength - value.byteOffset;
const size = !length || valueLength < length ? valueLength : length;
const size = !length || value.byteLength < length
? value.byteLength
: length;
new Uint8Array(view.buffer, view.byteOffset, view.byteLength).set(new Uint8Array(value.buffer, value.byteOffset, size), start);

@@ -28,9 +30,3 @@ return size;

}
Object.defineProperty(BinaryView, "viewLength", {
enumerable: true,
configurable: true,
writable: true,
value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gICAgcmV0dXJuIHRoaXMuZ2V0KCk7XG4gIH1cbn1cbiJdfQ==
//# sourceMappingURL=binary-view.js.map

@@ -1,59 +0,15 @@

/**
* Uses Uint32Array as an array or vector of bits. It's a simpler version of BitField
* that only sets and checks individual bits.
*
* @example
* const array = BitArray.create(10);
* array.getBit(0);
* //=> 0
* array.setBit(0).getBit(0);
* //=> 1
* array.size;
* //=> 10
* array.length;
* //=> 1
*/
export class BitArray extends Uint32Array {
constructor() {
super(...arguments);
Object.defineProperty(this, "lastPosition", {
enumerable: true,
configurable: true,
writable: true,
value: { bucket: 0, position: 0 }
});
}
lastPosition = { bucket: 0, position: 0 };
static get [Symbol.species]() {
return Uint32Array;
}
/**
* The amount of bits in the array.
*/
get size() {
return this.length << 5;
}
/**
* Creates a BitArray of the specified size.
*
* @param size the maximum amount of bits in the array
* @return a new BitArray
*/
static create(size) {
return new this(this.getLength(size));
}
/**
* Returns the length of the underlying TypedArray required to hold the given amount of bits.
*
* @param size the amount of bits
* @return the required length
*/
static getLength(size) {
return Math.ceil(size / 32);
}
/**
* Returns the bit at a given index.
*
* @param index the index
* @return the bit
*/
getBit(index) {

@@ -69,9 +25,2 @@ const { bucket, position } = this.getBitPosition(index);

}
/**
* Sets the bit at a given index.
*
* @param index the index
* @param value the value
* @return this
*/
setBit(index, value = 1) {

@@ -83,3 +32,3 @@ const { bucket, position } = this.getBitPosition(index);

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYml0LWFycmF5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYml0LWFycmF5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCQSxNQUFNLE9BQU8sUUFBUyxTQUFRLFdBQVc7SUFDdkMsWUFBWSxHQUFnQixFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLENBQUMsRUFBRSxDQUFDO0lBRXZELE1BQU0sS0FBSyxDQUFDL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"./utilities.js";

class BitField {
static schema;
static fields;
static masks;
static offsets;
static mask = 2 << 30;
static size = 31;
value = 0;
constructor(data = 0) {
Object.defineProperty(this, "value", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
this.value = typeof data === "number"

@@ -123,37 +124,3 @@ ? data

}
Object.defineProperty(BitField, "mask", {
enumerable: true,
configurable: true,
writable: true,
value: 2 << 30
});
Object.defineProperty(BitField, "size", {
enumerable: true,
configurable: true,
writable: true,
value: 31
});
/**
* Creates a BitField class from with a given schema. BitField uses numbers as bitfields
* to store and operate on data using bitwise operations. The size of the field is limited to 31 bits,
* for a larger bitfields consider using BigBitField class that uses bigints instead.
*
* @param schema the schema
* @returns the BitFieldClass
*
* @example
* const Field = BitFieldMixin({ width: 8, height: 8 });
* const field = new Field({ width: 100, height: 200 });
* field.get('width');
* //=> 100;
* field.get('height');
* //=> 200
* field.set('width', 18);
* field.get('width');
* //=> 18
* field.toObject();
* //=> { width: 18, height: 200 }
*/
export function BitFieldMixin(schema) {
var _a;
const fields = Object.keys(schema);

@@ -173,44 +140,10 @@ const masks = {};

}
return _a = class extends BitField {
constructor() {
super(...arguments);
Object.defineProperty(this, "size", {
enumerable: true,
configurable: true,
writable: true,
value: lastOffset
});
Object.defineProperty(this, "mask", {
enumerable: true,
configurable: true,
writable: true,
value: 2 << (lastOffset - 1)
});
}
},
Object.defineProperty(_a, "schema", {
enumerable: true,
configurable: true,
writable: true,
value: schema
}),
Object.defineProperty(_a, "fields", {
enumerable: true,
configurable: true,
writable: true,
value: fields
}),
Object.defineProperty(_a, "masks", {
enumerable: true,
configurable: true,
writable: true,
value: masks
}),
Object.defineProperty(_a, "offsets", {
enumerable: true,
configurable: true,
writable: true,
value: offsets
}),
_a;
return class extends BitField {
static schema = schema;
static fields = fields;
static masks = masks;
static offsets = offsets;
size = lastOffset;
mask = 2 << (lastOffset - 1);
};
}

@@ -251,3 +184,3 @@ const _BitField = BitFieldMixin({

export { _BitField as BitField };
//# sourceMappingURL=data:application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HsgX0JpdEZpZWxkIGFzIEJpdEZpZWxkIH07XG4iXX0=
//# sourceMappingURL=bit-field.js.map

@@ -12,20 +12,5 @@ import { BinaryHeap } from "./binary-heap.js";

}
/**
* Creates a Graph class extending a given adjacency structure.
*/
export function GraphMixin(Base) {
/**
* Extends an adjacency list/matrix structure and provides methods for traversal (BFS, DFS),
* pathfinding (Dijkstra, Bellman-Ford), spanning tree construction (BFS, Prim), etc.
*/
class Graph extends Base {
constructor() {
super(...arguments);
Object.defineProperty(this, "_colors", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
}
_colors;
get colors() {

@@ -38,5 +23,2 @@ return (this._colors ||

}
/**
* Checks whether the graph is acyclic.
*/
isAcyclic() {

@@ -49,10 +31,2 @@ for (const vertex of this.traverse(true, 0, false, true)) {

}
/**
* Returns a list of vertices along the shortest path between two given vertices.
*
* @param start the starting vertex
* @param end the ending vertex
* @param isAcyclic whether the graph is acyclic
* @param isNonNegative whether all edges are non-negative
*/
path(start, end, isAcyclic = false, isNonNegative = false) {

@@ -81,16 +55,5 @@ const { weighted } = this

}
/**
* Resets all coloring of vertices done during traversals.
*/
resetColors() {
this.colors.fill(0);
}
/**
* For all.
*
* @param start
* @param end
* @param distances
* @param predecessors
*/
searchBellmanFord(start, end, distances, predecessors) {

@@ -115,10 +78,2 @@ const { vertices } = this;

}
/**
* For non-negative edges.
*
* @param start
* @param end
* @param distances
* @param predecessors
*/
searchDijkstra(start, end, distances, predecessors) {

@@ -150,10 +105,2 @@ this.resetColors();

}
/**
* For DAGs only.
*
* @param start
* @param end
* @param distances
* @param predecessors
*/
searchTopological(start, end, distances, predecessors) {

@@ -180,9 +127,2 @@ distances[start] = 0;

}
/**
* For unweighted graphs.
*
* @param start the starting vertex
* @param end the ending vertex
* @param predecessors
*/
searchUnweighted(start, end, predecessors) {

@@ -210,5 +150,2 @@ let lastPredecessor = start;

}
/**
* Returns a list of vertexes sorted topologically.
*/
topologicalSort() {

@@ -221,12 +158,2 @@ const result = [];

}
/**
* Does a Breadth-First or Depth-First traversal of the graph.
*
* @param isDFS whether to do DFS traversal, does BFS otherwise
* @param start the vertex to start at
* @param gray whether to return vertices upon entering
* @param white whether to return edges upon first encountering
* @param black whether to return vertices after processing
* @return the vertex at each step
*/
*traverse(isDFS = false, start = 0, gray = true, white = false, black = false) {

@@ -255,8 +182,2 @@ this.resetColors();

}
/**
* Returns a minimal spanning tree of the graph.
* Uses the Prim's algorithm for weighted graphs and BFS tree for unweighted graphs.
*
* @param start
*/
tree(start = 0) {

@@ -296,3 +217,3 @@ const { weighted } = this

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JhcGguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJncmFwaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFOUMsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHO0lBQ3BCLEtBQUssRUFBRSxDQUFDO0lBQ1IsSUFBSSxFQUFFLENBQUM7SUFDUCxLQUFLLEVBQUUsQ0FBQztDQUNBLENBQUM7QUFNWCxNQUFNLFVBQVcsU0FBUSxVQUFrQjtJQUN6QyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQVMsRUFBRSxDQUFTO1FBQ2pDLE9BQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ25CLENBQUM7Q0FDRjtBQUtELE1BQU0sVUFBVSxVQUFVLENBR3hCLElBQU87SUFRUCxNQUFNLEtBQU0sU0FBUSxJQUFJO1FBQ3RCLE9BQU8sQ0FBYztRQUVyQixJQUFJLE1BQU07WUFDUixPQUFPLENBQ0wsSUFBSSxDQUFDLE9BQU87Z0JBQ1osQ0FBQyxDQUFDLElBQUksQ0FBQyxPQUFPLEdBQUcsSUFBSSxVQUFVLENBQUMsSUF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dID0gMDtcbiAgICAgIGhlYXAucHVzaCh7IGU6IHN0YXJ0LCB3OiB0aGlzWzBdIH0pO1xuICAgICAgd2hpbGUgKGhlYXAubGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHZlcnRleCA9IGhlYXAuc2hpZnQoKSE7XG4gICAgICAgIGlmICh0aGlzLmhhc0NvbG9yKHZlcnRleC5lLCBDb2xvcnMuR1JBWSkpIGNvbnRpbnVlO1xuICAgICAgICB0aGlzLnNldENvbG9yKHZlcnRleC5lLCBDb2xvcnMuR1JBWSk7XG4gICAgICAgIGZvciAoY29uc3QgZWRnZSBvZiB0aGlzLm91dEVkZ2VzKHZlcnRleC5lKSkge1xuICAgICAgICAgIGNvbnN0IHdlaWdodCA9IHRoaXMuZ2V0RWRnZSh2ZXJ0ZXguZSwgZWRnZSk7XG4gICAgICAgICAgaWYgKHRoaXMuaGFzQ29sb3IoZWRnZSwgQ29sb3JzLkdSQVkpIHx8IHdlaWdodCA+IGRpc3RhbmNlc1tlZGdlXSkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIGRpc3RhbmNlc1tlZGdlXSA9IHdlaWdodDtcbiAgICAgICAgICBwcmVkZWNlc3NvcnNbZWRnZV0gPSB2ZXJ0ZXguZTtcbiAgICAgICAgICBoZWFwLnB1c2goeyBlOiBlZGdlLCB3OiB3ZWlnaHQgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBwcmVkZWNlc3NvcnM7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIEdyYXBoO1xufVxuIl19
//# sourceMappingURL=graph.js.map
import { getLog2 } from "./utilities.js";
/**
* Creates a Grid class extending a given Array-like class.
*/
export function GridMixin(Base) {
/**
* Extends built-in indexed collections to handle 2 dimensional data.
*/
return class Grid extends Base {
constructor() {
super(...arguments);
Object.defineProperty(this, "size", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
size = 0;
static get [Symbol.species]() {
return Base;
}
/**
* Number of columns in the grid.
*/
get columns() {
return 1 << this.size;
}
/**
* Specifies the number of columns of the grid.
*/
set columns(columns) {
this.size = getLog2(columns);
}
/**
* Number of rows in the grid.
*/
get rows() {
//@ts-ignore 2339
return this.length >> this.size;
}
/**
* Creates a grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return a new grid
*/
static create(rows, columns = 1) {

@@ -55,12 +24,5 @@ const offset = getLog2(columns);

}
/**
* Creates a grid from an array of arrays.
*
* @param arrays the array of arrays
* @return a new grid
*/
static fromArrays(arrays) {
const rows = arrays.length;
// find longest array to get the column size
let columns = arrays[0].length; // if !arrays[0].length
let columns = arrays[0].length;
for (let i = 0; i < rows; i++) {

@@ -72,5 +34,3 @@ if (arrays[i].length > columns)

columns = 1 << offset;
// create grid of the required length
const grid = this.create(rows, columns);
// fill the grid with values from arrays
for (let i = 0; i < rows; i++) {

@@ -84,9 +44,2 @@ const rowId = i << offset;

}
/**
* Returns the length of the underlying Array required to hold the grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return the required length
*/
static getLength(rows, columns = 1) {

@@ -98,30 +51,8 @@ return rows << getLog2(columns);

}
/**
* Returns the index of an element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the element index
*/
getIndex(row, column = 1) {
return (row << this.size) + column;
}
/**
* Returns the element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the element
*/
getValue(row, column) {
return this[this.getIndex(row, column)];
}
/**
* Sets the element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @param value the element
* @return the grid
*/
setValue(row, column, value) {

@@ -131,7 +62,2 @@ this[this.getIndex(row, column)] = value;

}
/**
* Creates an array of arrays representing rows of the grid.
*
* @return an array of arrays
*/
toArrays() {

@@ -151,3 +77,3 @@ const { rows, columns, size } = this;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JpZC5qcyIsInNvdXJjZVJvb3QiOiI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VtYmVyLCB2YWx1ZTogSXRlbVR5cGUpOiB0aGlzIHtcbiAgICAgIHRoaXNbdGhpcy5nZXRJbmRleChyb3csIGNvbHVtbildID0gdmFsdWU7XG4gICAgICByZXR1cm4gdGhpcztcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGFuIGFycmF5IG9mIGFycmF5cyByZXByZXNlbnRpbmcgcm93cyBvZiB0aGUgZ3JpZC5cbiAgICAgKlxuICAgICAqIEByZXR1cm4gYW4gYXJyYXkgb2YgYXJyYXlzXG4gICAgICovXG4gICAgdG9BcnJheXMoKTogQXJyYXk8QXJyYXk8SXRlbVR5cGU+PiB7XG4gICAgICBjb25zdCB7IHJvd3MsIGNvbHVtbnMsIHNpemUgfSA9IHRoaXM7XG4gICAgICBjb25zdCByZXN1bHQ6IEFycmF5PEFycmF5PEl0ZW1UeXBlPj4gPSBbXTtcbiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcm93czsgaSsrKSB7XG4gICAgICAgIGNvbnN0IHJvd09mZnNldCA9IGkgPDwgc2l6ZTtcbiAgICAgICAgcmVzdWx0W2ldID0gW107XG4gICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgY29sdW1uczsgaisrKSB7XG4gICAgICAgICAgcmVzdWx0W2ldW2pdID0gdGhpc1tyb3dPZmZzZXQgKyBqXTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG4gIH07XG59XG4iXX0=
//# sourceMappingURL=grid.js.map
{
"name": "structurae",
"version": "4.0.0-pre.10",
"version": "4.0.0-pre.11",
"description": "Data structures for performance-sensitive modern JavaScript applications.",

@@ -5,0 +5,0 @@ "main": "index.js",

import { BitArray } from "./bit-array.js";
import { getLSBIndex } from "./utilities.js";
/**
* Implements a fast algorithm to manage availability of objects in an object pool using a BitArray.
*
* @example
* // create a pool of 1600 indexes
* const pool = Pool.create(100 * 16);
*
* // get the next available index and make it unavailable
* pool.get();
* //=> 0
* pool.get();
* //=> 1
*
* // set index available
* pool.free(0);
* pool.get();
* //=> 0
*
* pool.get();
* //=> 2
*/
export class Pool extends BitArray {
constructor() {
super(...arguments);
Object.defineProperty(this, "nextAvailable", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
/**
* Creates a Pool of the specified size.
*
* @param size the size of the pool
* @return a new Pool
*/
nextAvailable = 0;
static create(size) {

@@ -45,7 +10,2 @@ const pool = new this(this.getLength(size));

}
/**
* Makes a given index available.
*
* @param index index to be freed
*/
free(index) {

@@ -56,7 +16,2 @@ const { bucket, position } = this.getBitPosition(index);

}
/**
* Gets the next available index in the pool.
*
* @return the next available index
*/
get() {

@@ -69,3 +24,2 @@ const { nextAvailable } = this;

this[nextAvailable] &= ~(1 << index);
// record is full, find next empty
if (this[nextAvailable] === 0) {

@@ -83,3 +37,3 @@ this.nextAvailable = -1;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9vbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInBvb2wudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzFDLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQXVCN0MsTUFBTSxPQUFPLElBQUssU0FBUSxRQUFRO0lBQ2hDLGFBQWEsR0FBRyxDQUFDLENBQUM7SUFRbEIsTUFBTSxDQUFDLE1BQU0sQ0FFWCxJQUFZO1FBRVosTUFBTSxJQUFJLEdBQUcsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1FBQzVDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUM7UUFDdEIsT0FBTyxJQUF1QixDQUFDO0lBQ2pDLENBQUM7SUFPRCx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0gMCkge1xuICAgICAgdGhpcy5uZXh0QXZhaWxhYmxlID0gLTE7XG4gICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRoaXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYgKHRoaXNbaV0gIT09IDApIHtcbiAgICAgICAgICB0aGlzLm5leHRBdmFpbGFibGUgPSBpO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIChuZXh0QXZhaWxhYmxlIDw8IDUpICsgaW5kZXg7XG4gIH1cbn1cbiJdfQ==
//# sourceMappingURL=pool.js.map
import { BitArray } from "./bit-array.js";
import { getLSBIndex, popCount32 } from "./utilities.js";
/**
* A bit array that supports constant time rank and O(logN) time select operations.
*
* @example
* const array = RankedBitArray.create(10);
* array.setBit(1).setBit(3).setBit(7);
* array.rank(2);
* //=> 1
* array.rank(7);
* //=> 2
* array.select(2);
* //=> 3
*/
export class RankedBitArray extends BitArray {
/**
* The amount of bits in the array.
*/
get size() {
return (this.length >> 1) << 5;
}
/**
* Returns the length of the underlying TypedArray required to hold the given amount of bits.
*
* @param size the amount of bits
* @return the required length
*/
static getLength(size) {
return Math.ceil(size / 32) << 1;
}
/**
* Returns the rank of a bit at a given index.
*
* @param index the index
* @return the rank
*/
rank(index) {
const { bucket, position } = this.getBitPosition(index);
const value = this[bucket];
// mask out following bits
const masked = value & ((1 << position) - 1);

@@ -47,8 +18,2 @@ const localRank = popCount32(masked);

}
/**
* Returns the select of a bit at a given index.
*
* @param index the index
* @return the select
*/
select(index) {

@@ -68,3 +33,2 @@ const middle = this.length >> 1;

else if (index === this[bucketRankId - 1]) {
// preceded by a duplicate
right = bucketRankId - 1;

@@ -92,9 +56,2 @@ }

}
/**
* Sets the bit at a given index.
*
* @param index the index
* @param value the value
* @return this
*/
setBit(index, value = 1) {

@@ -109,3 +66,3 @@ super.setBit(index, value);

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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lvbiA9IGdldExTQkluZGV4KHZhbHVlKTtcbiAgICAgIHZhbHVlICY9IHZhbHVlIC0gMTtcbiAgICAgIHJhbmsrKztcbiAgICAgIGlmIChyYW5rID09PSBpbmRleCkge1xuICAgICAgICByZXR1cm4gKGJ1Y2tldCA8PCA1KSArIHBvc2l0aW9uO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTE7XG4gIH1cblxuICAvKipcbiAgICogU2V0cyB0aGUgYml0IGF0IGEgZ2l2ZW4gaW5kZXguXG4gICAqXG4gICAqIEBwYXJhbSBpbmRleCB0aGUgaW5kZXhcbiAgICogQHBhcmFtIHZhbHVlIHRoZSB2YWx1ZVxuICAgKiBAcmV0dXJuIHRoaXNcbiAgICovXG4gIHNldEJpdChpbmRleDogbnVtYmVyLCB2YWx1ZTogQml0ID0gMSk6IHRoaXMge1xuICAgIHN1cGVyLnNldEJpdChpbmRleCwgdmFsdWUpO1xuICAgIGNvbnN0IGNoYW5nZSA9IHZhbHVlIHx8IC0xO1xuICAgIGZvciAoXG4gICAgICBsZXQgaSA9ICh0aGlzLmxlbmd0aCA+PiAxKSArIHRoaXMubGFzdFBvc2l0aW9uLmJ1Y2tldDtcbiAgICAgIGkgPCB0aGlzLmxlbmd0aDtcbiAgICAgIGkrK1xuICAgICkge1xuICAgICAgdGhpc1tpXSArPSBjaGFuZ2U7XG4gICAgfVxuICAgIHJldHVybiB0aGlzO1xuICB9XG59XG4iXX0=
//# sourceMappingURL=ranked-bit-array.js.map

@@ -57,3 +57,3 @@ # Structurae

```
import {...} from "https://deno.land/x/structurae@4.0.0-pre.9/index.ts"
import {...} from "https://deno.land/x/structurae@4.0.0-pre.11/index.ts"
```

@@ -280,2 +280,29 @@

#### Dictionaries
Objects and maps described above assume that all properties of encoded objects
are known and defined beforehand, however, if the properties are not known, and
we are dealing with an object used as a lookup table (also called map, hash map,
or records in TypeScript) with varying amount of properties and known type of
values, we can use a dictionary view:
```typescript
const NumberDict = View.create<Record<number, string | undefined>>({
$id: "NumberDict",
type: "object",
btype: "dict", // dictionaries use btype dict
// the type of keys are defined in the `propertyNames` field of a schema
// the keys must be either fixed sized strings or numbers
propertyNames: { type: "number", btype: "uint8" },
// the type of values defined in `addtionalProperties` field
// values can be of any supported type
additionalProperties: { type: "string" },
});
const dict = NumberDict.from({ 1: "a", 2: "bcd", 3: undefined });
dict.get(1); //=> "a"
dict.get(3); //=> undefined
dict.get(10); //=> undefined
dict.get(2); //=> "bcd"
```
#### Arrays and Vectors

@@ -282,0 +309,0 @@

@@ -1,21 +0,3 @@

/**
* Extends Array to handle sorted data.
*/
export class SortedArray extends Array {
constructor() {
super(...arguments);
Object.defineProperty(this, "unique", {
enumerable: true,
configurable: true,
writable: true,
value: false
});
}
/**
* The default comparator.
*
* @param a the first value
* @param b the second value
* @throws RangeError if the comparison is unstable
*/
unique = false;
static compare(a, b) {

@@ -37,28 +19,2 @@ if (a > b)

}
/**
* Returns the difference of two sorted arrays,
* i.e. elements present in the first array but not in the second array.
* If `symmetric=true` finds the symmetric difference of two arrays, that is,
* the elements that are absent in one or another array.
*
* @param a the first array
* @param b the second array
* @param [symmetric=false] whether to get symmetric difference.
* @param [comparator] the comparator static used to sort the arrays
* @param [container] an array-like object to hold the results
* @return the difference of the arrays
* @example
*
* SortedArray.getDifference([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
* //=> [ 1, 3, 8 ]
*
* // symmetric difference of sorted arrays:
* SortedArray.getDifference(first, second, true);
* //=> [ 1, 3, 6, 7, 8, 9 ]
* // difference using a custom comparator:
* const customComparator = (a, b) => (a > b ? -1 : a < b ? 1 : 0);
* SortedArray.getDifference([8, 4, 3, 2, 1], [9, 7, 6, 4, 2], false, customComparator);
* //=> [ 8, 3, 1 ]
*/
static getDifference(a, b, symmetric = false, comparator = this.compare, container = []) {

@@ -95,15 +51,2 @@ let i = 0;

}
/**
* Returns the amount of differing elements in the first array.
*
* @param a the first array
* @param b the second array
* @param [symmetric=false] whether to use symmetric difference
* @param [comparator] the comparator static used to sort the arrays
* @return the amount of differing elements
* @example
*
* SortedArray.getDifferenceScore([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
* //=> 3
*/
static getDifferenceScore(a, b, symmetric = false, comparator = this.compare) {

@@ -113,17 +56,2 @@ const score = this.getIntersectionScore(a, b, comparator);

}
/**
* Uses binary search to find the index of an element inside a sorted array.
*
* @param arr the array to search
* @param target the target value to search for
* @param [comparator] a custom comparator
* @param [rank=false] whether to return the element's rank if the element isn't found
* @param [start] the start position of the search
* @param [end] the end position of the search
* @return the index of the searched element or it's rank
* @example
*
* SortedArray.getIndex([1, 2, 3, 4, 8], 4);
* //=> 3
*/
static getIndex(arr, target, comparator = this.compare, rank = false, start = 0, end = arr.length - 1) {

@@ -148,20 +76,2 @@ let left = start;

}
/**
* Returns the intersection of two sorted arrays.
*
* @param a the first array
* @param b the second array
* @param [comparator] the comparator static used to sort the arrays
* @param [container] an array-like object to hold the results
* @return the intersection of the arrays
* @example
*
* SortedArray.getIntersection([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
* //=> [ 2, 4 ]
*
* // intersection using a custom comparator:
* const customComparator = (a, b) => (a > b ? -1 : a < b ? 1 : 0);
* SortedArray.getIntersection([8, 4, 3, 2, 1], [9, 7, 6, 4, 2], customComparator);
* //=> [ 4, 2 ]
*/
static getIntersection(a, b, comparator = this.compare, container = []) {

@@ -186,14 +96,2 @@ let i = 0;

}
/**
* Returns the amount of common elements in two sorted arrays.
*
* @param a the first array
* @param b the second array
* @param [comparator] the comparator static used to sort the arrays
* @return the amount of different elements
* @example
*
* SortedArray.getIntersection([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
* //=> 2
*/
static getIntersectionScore(a, b, comparator = this.compare) {

@@ -219,20 +117,2 @@ let score = 0;

}
/**
* Returns a range of elements of a sorted array from the start through the end inclusively.
*
* @param arr the array
* @param [start] the starting item
* @param [end] the ending item
* @param [comparator] a custom comparator
* @param [subarray] return a subarray instead of copying resulting value with slice
* @return the range of items
* @example
*
* SortedArray.getRange([1, 2, 3, 4, 8], 2, 4);
* //=> [ 2, 3, 4 ]
*
* const customComparator = (a, b) => (a > b ? -1 : a < b ? 1 : 0);
* SortedArray.getRange([8, 4, 3, 2, 1], 8, 3, customComparator);
* //=> [ 8, 4, 3 ]
*/
static getRange(arr, start, end, comparator, subarray) {

@@ -247,27 +127,5 @@ const startIndex = start === undefined

? arr.subarray(startIndex, endIndex)
: // deno-lint-ignore no-explicit-any
:
arr.slice(startIndex, endIndex);
}
/**
* Returns the union of two sorted arrays as a sorted array.
*
* @param a the first array
* @param b the second array
* @param [unique=false] whether to avoid duplicating items when merging unique arrays
* @param [comparator] the comparator static used to sort the arrays
* @param [container] an array-like object to hold the results
* @return the union of the arrays
* @example
*
* SortedArray.getUnion([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
* //=> [ 1, 2, 2, 3, 4, 4, 6, 7, 8, 9 ]
*
* // union of sorted arrays without duplicates:
* SortedArray.getUnion([1, 2, 3, 4, 8], [2, 4, 6, 7, 9], true);
* //=> [ 1, 2, 3, 4, 6, 7, 8, 9 ]
*
* //union using a custom comparator:
* SortedArray.getUnion([8, 4, 3, 2, 1], [9, 7, 6, 4, 2], true, customComparator);
* //=> [ 9, 8, 7, 6, 4, 3, 2, 1 ]
*/
static getUnion(a, b, unique = false, comparator = this.compare, container = []) {

@@ -304,14 +162,2 @@ let i = 0;

}
/**
* Returns an array of unique elements from a sorted array.
*
* @param arr the sorted array
* @param [comparator] a custom comparator
* @param [container] an array-like object to hold the results
* @return the sorted array without duplicates
* @example
*
* SortedArray.getUnique([1, 1, 2, 2, 3, 4]);
* //=> [ 1, 2, 3, 4 ]
*/
static getUnique(arr, comparator = this.compare, container = []) {

@@ -326,14 +172,2 @@ container[0] = arr[0];

}
/**
* Checks whether an array is sorted according to a provided comparator.
*
* @param arr the array to check
* @param [comparator] a custom comparator
* @return whether the array is sorted
*
* @example
*
* SortedArray.isSorted([1, 2, 3, 4, 8]);
* //=> true
*/
static isSorted(arr, comparator = this.compare) {

@@ -346,13 +180,2 @@ for (let i = 1; i < arr.length; i++) {

}
/**
* Checks whether an array has any duplicating elements.
*
* @param arr the array to check
* @param [comparator] a custom comparator
* @return whether the array has duplicating elements
* @example
*
* SortedArray.isUnique([1, 2, 2, 3, 4]);
* //=> false
*/
static isUnique(arr, comparator = this.compare) {

@@ -365,9 +188,2 @@ for (let i = 1; i < arr.length; i++) {

}
/**
* Creates a new SortedArray instance with a variable number of arguments,
* regardless of number or type of the arguments
*
* @param elements the elements of which to create the array
* @return the new SortedArray
*/
static of(...elements) {

@@ -378,12 +194,5 @@ const result = super.of(...elements);

}
/**
* Returns a merger of the array with one or more provided sorted arrays.
*
* @param arrays sorted array(s) to merge
* @return a new SortedArray
*/
concat(...arrays) {
const constructor = this.constructor;
let result = this.slice(0);
// TODO rewrite
for (let i = 0; i < arrays.length; i++) {

@@ -394,54 +203,14 @@ result = constructor.getUnion(result, arrays[i], this.unique, constructor.compare, new constructor());

}
/**
* Uses binary search to quickly check if the element is the array.
* @param element the element to check
* @return whether the element is in the array
*/
includes(element) {
return !!~this.indexOf(element);
}
/**
* Looks for the index of a given element in the array or -1
*
* @param element the element to look for
* @return the element's index in the array or -1
*/
indexOf(element) {
return this.constructor.getIndex(this, element);
}
/**
* Checks if the array is sorted.
*
* @return whether the array is sorted
* @example
*
* //=> SortedArray [ 2, 3, 4, 5, 9 ];
* SortedArray.isSorted();
* //=> true
* SortedArray.reverse();
* SortedArray.isSorted();
* //=> false;
*/
isSorted() {
return this.constructor.isSorted(this);
}
/**
* Checks if the array has duplicating elements.
*
* @return whether the array has duplicating elements
* @example
*
* //=> SortedArray [ 2, 3, 3, 4, 5, 9 ];
* SortedArray.isUnique();
* //=> false;
*/
isUnique() {
return this.constructor.isUnique(this);
}
/**
* Adds provided elements to the array preserving the sorted order of the array.
*
* @param elements the elements to add to the array
* @return the new length of the array
*/
push(...elements) {

@@ -472,19 +241,2 @@ const { compare } = this.constructor;

}
/**
* Returns a range of elements of the array that are greater or equal to the provided
* starting element and less or equal to the provided ending element.
*
* @param start the starting element
* @param end the ending element
* @return the resulting range of elements
* @example
*
* //=> SortedArray [ 2, 3, 4, 5, 9 ];
* SortedArray.range(3, 5);
* // => [ 3, 4, 5 ]
* SortedArray.range(undefined, 4);
* // => [ 2, 3, 4 ]
* SortedArray.range(4);
* // => [ 4, 5, 8 ]
*/
range(start, end) {

@@ -494,15 +246,2 @@ const constructor = this.constructor;

}
/**
* Returns the rank of an element in the array.
*
* @param element the element to look for
* @return the rank in the array
* @example
*
* //=> SortedArray [ 2, 3, 4, 5, 9 ];
* SortedArray.rank(1);
* // => 0
* SortedArray.rank(6);
* // => 4
*/
rank(element) {

@@ -512,13 +251,2 @@ const constructor = this.constructor;

}
/**
* Implements in-place replacement of the array elements.
*
* @param arr an array of new elements to use
*
* @example
*
* //=> SortedArray [ 2, 3, 4, 5, 9 ];
* sortedArray.set([1, 2, 3]);
* //=> SortedArray [ 1, 2, 3 ]
*/
set(arr) {

@@ -531,7 +259,2 @@ this.length = arr.length;

}
/**
* Sorts the array with a provided compare function.
*
* @param compareFunction the function to use for comparison
*/
sort(compareFunction = this

@@ -541,10 +264,2 @@ .constructor.compare) {

}
/**
* Changes the array by removing existing elements and adding new ones.
*
* @param start the index at which to start changing the array
* @param deleteCount the amount of old elements to delete
* @param elements the elements to add to the array
* @return an array of deleted elements
*/
splice(start, deleteCount, ...elements) {

@@ -555,11 +270,2 @@ const deletedElements = super.splice(start, deleteCount);

}
/**
* Removes duplicating elements from the array.
*
* @example
*
* //=> SortedArray [ 2, 2, 3, 4, 5, 5, 9 ];
* sortedArray.uniquify();
* // => SortedArray [ 2, 3, 4, 5, 9 ]
*/
uniquify() {

@@ -569,8 +275,2 @@ const constructor = this.constructor;

}
/**
* Adds provided elements to the array preserving the sorted order of the array.
*
* @param elements the elements to add to the array
* @return the new length of the array
*/
unshift(...elements) {

@@ -580,3 +280,3 @@ return this.push(...elements);

}
//# sourceM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0aW9uPFQ+PihcbiAgICBhOiBVLFxuICAgIGI6IFUsXG4gICAgc3ltbWV0cmljID0gZmFsc2UsXG4gICAgY29tcGFyYXRvcjogQ29tcGFyYXRvcjxUPiA9IHRoaXMuY29tcGFyZSxcbiAgICBjb250YWluZXI6IFUgPSAoW10gYXMgdW5rbm93bikgYXMgVSxcbiAgKTogdHlwZW9mIGNvbnRhaW5lciB7XG4gICAgbGV0IGkgPSAwO1xuICAgIGxldCBqID0gMDtcbiAgICB3aGlsZSAoaSA8IGEubGVuZ3RoICYmIGogPCBiLmxlbmd0aCkge1xuICAgICAgY29uc3QgY29tcGFyZWQgPSBjb21wYXJhdG9yKGFbaV0sIGJbal0pO1xuICAgICAgaWYgKGNvbXBhcmVkID4gMCkge1xuICAgICAgICBpZiAoc3ltbWV0cmljKSBjb250YWluZXJbY29udGFpbmVyLmxlbmd0aF0gPSBiW2pdO1xuICAgICAgICBqKys7XG4gICAgICB9IGVsc2UgaWYgKGNvbXBhcmVkIDwgMCkge1xuICAgICAgICBjb250YWluZXJbY29udGFpbmVyLmxlbmd0aF0gPSBhW2ldO1xuICAgICAgICBpKys7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBpKys7XG4gICAgICAgIGorKztcbiAgICAgIH1cbiAgICB9XG4gICAgd2hpbGUgKGkgPCBhLmxlbmd0aCkge1xuICAgICAgY29udGFpbmVyW2NvbnRhaW5lci5sZW5ndGhdID0gYVtpXTtcbiAgICAgIGkrKztcbiAgICB9XG4gICAgaWYgKHN5bW1ldHJpYykge1xuICAgICAgd2hpbGUgKGogPCBiLmxlbmd0aCkge1xuICAgICAgICBjb250YWluZXJbY29udGFpbmVyLmxlbmd0aF0gPSBiW2pdO1xuICAgICAgICBqKys7XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiBjb250YWluZXI7XG4gIH1cblxuICAvKipcbiAgICogUmV0dXJucyB0aGUgYW1vdW50IG9mIGRpZmZlcmluZyBlbGVtZW50cyBpbiB0aGUgZmlyc3Q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W50cztcbiAgfVxuXG4gIC8qKlxuICAgKiBSZW1vdmVzIGR1cGxpY2F0aW5nIGVsZW1lbnRzIGZyb20gdGhlIGFycmF5LlxuICAgKlxuICAgKiBAZXhhbXBsZVxuICAgKlxuICAgKiAvLz0+IFNvcnRlZEFycmF5IFsgMiwgMiwgMywgNCwgNSwgNSwgOSBdO1xuICAgKiBzb3J0ZWRBcnJheS51bmlxdWlmeSgpO1xuICAgKiAvLyA9PiBTb3J0ZWRBcnJheSBbIDIsIDMsIDQsIDUsIDkgXVxuICAgKi9cbiAgdW5pcXVpZnkoKSB7XG4gICAgY29uc3QgY29uc3RydWN0b3IgPSB0aGlzLmNvbnN0cnVjdG9yIGFzIHR5cGVvZiBTb3J0ZWRBcnJheTtcbiAgICByZXR1cm4gdGhpcy5zZXQoXG4gICAgICBjb25zdHJ1Y3Rvci5nZXRVbmlxdWUodGhpcywgY29uc3RydWN0b3IuY29tcGFyZSwgbmV3IGNvbnN0cnVjdG9yKCkpLFxuICAgICk7XG4gIH1cblxuICAvKipcbiAgICogQWRkcyBwcm92aWRlZCBlbGVtZW50cyB0byB0aGUgYXJyYXkgcHJlc2VydmluZyB0aGUgc29ydGVkIG9yZGVyIG9mIHRoZSBhcnJheS5cbiAgICpcbiAgICogQHBhcmFtIGVsZW1lbnRzIHRoZSBlbGVtZW50cyB0byBhZGQgdG8gdGhlIGFycmF5XG4gICAqIEByZXR1cm4gdGhlIG5ldyBsZW5ndGggb2YgdGhlIGFycmF5XG4gICAqL1xuICB1bnNoaWZ0KC4uLmVsZW1lbnRzOiBBcnJheTxJdGVtVHlwZT4pIHtcbiAgICByZXR1cm4gdGhpcy5wdXNoKC4uLmVsZW1lbnRzKTtcbiAgfVxufVxuIl19
//# sourceMappingURL=sorted-array.js.map

@@ -1,46 +0,16 @@

/**
* Creates a SymmetricGrid class extending a given Array-like class.
*/
export function SymmetricGridMixin(Base) {
/**
* Implements a grid to handle symmetric or triangular matrices using half the space required for a normal grid.
*/
return class SymmetricGrid extends Base {
constructor() {
super(...arguments);
Object.defineProperty(this, "size", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
}
size = 0;
static get [Symbol.species]() {
return Base;
}
/**
* Number of columns in the grid.
*/
get columns() {
return this.size;
}
/**
* Specifies the number of columns of the grid.
*/
set columns(columns) {
this.size = columns;
}
/**
* Number of rows in the grid.
*/
get rows() {
return this.size;
}
/**
* Creates a grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return a new grid
*/
static create(columns) {

@@ -52,8 +22,2 @@ const length = this.getLength(columns);

}
/**
* Creates a grid from an array of arrays.
*
* @param arrays the array of arrays
* @return a new grid
*/
static fromArrays(arrays) {

@@ -71,9 +35,2 @@ const rows = arrays.length;

}
/**
* Returns the length of the underlying Array required to hold the grid of specified dimensions.
*
* @param rows the amount of rows
* @param columns the amount of columns
* @return the required length
*/
static getLength(rows) {

@@ -87,9 +44,2 @@ return ((rows + 1) * rows) >> 1;

}
/**
* Returns the index of an element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the element index
*/
getIndex(row, column) {

@@ -99,20 +49,5 @@ const [x, y] = row >= column ? [column, row] : [row, column];

}
/**
* Returns the element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @return the element
*/
getValue(row, column) {
return this[this.getIndex(row, column)];
}
/**
* Sets the element at given coordinates.
*
* @param rows the row index
* @param columns the column index
* @param value the element
* @return the grid
*/
setValue(row, column, value) {

@@ -122,7 +57,2 @@ this[this.getIndex(row, column)] = value;

}
/**
* Creates an array of arrays representing rows of the grid.
*
* @return an array of arrays
*/
toArrays() {

@@ -145,3 +75,3 @@ const { rows } = this;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ltbWV0cmljLWdyaWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzeW1tZXRyaWMtZ3JpZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxNQUFNLFV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gMSkgKiByb3dzKSA+PiAxO1xuICAgIH1cblxuICAgIGdldENvb3JkaW5hdGVzKGluZGV4OiBudW1iZXIpOiBbcm93OiBudW1iZXIsIGNvbHVtbjogbnVtYmVyXSB7XG4gICAgICBjb25zdCByb3cgPSAoTWF0aC5zcXJ0KChpbmRleCA8PCAzKSArIDEpIC0gMSkgPj4gMTtcbiAgICAgIGNvbnN0IGNvbHVtbiA9IGluZGV4IC0gKChyb3cgKiAocm93ICsgMSkpID4+IDEpO1xuICAgICAgcmV0dXJuIFtyb3csIGNvbHVtbl07XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgaW5kZXggb2YgYW4gZWxlbWVudCBhdCBnaXZlbiBjb29yZGluYXRlcy5cbiAgICAgKlxuICAgICAqIEBwYXJhbSByb3dzIHRoZSByb3cgaW5kZXhcbiAgICAgKiBAcGFyYW0gY29sdW1ucyB0aGUgY29sdW1uIGluZGV4XG4gICAgICogQHJldHVybiB0aGUgZWxlbWVudCBpbmRleFxuICAgICAqL1xuICAgIGdldEluZGV4KHJvdzogbnVtYmVyLCBjb2x1bW46IG51bWJlcik6IG51bWJlciB7XG4gICAgICBjb25zdCBbeCwgeV0gPSByb3cgPj0gY29sdW1uID8gW2NvbHVtbiwgcm93XSA6IFtyb3csIGNvbHVtbl07XG4gICAgICByZXR1cm4geCArICgoKHkgKyAxKSAqIHkpID4+IDEpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIGVsZW1lbnQgYXQgZ2l2ZW4gY29vcmRpbmF0ZXMuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gcm93cyB0aGUgcm93IGluZGV4XG4gICAgICogQHBhcmFtIGNvbHVtbnMgdGhlIGNvbHVtbiBpbmRleFxuICAgICAqIEByZXR1cm4gdGhlIGVsZW1lbnRcbiAgICAgKi9cbiAgICBnZXRWYWx1ZShyb3c6IG51bWJlciwgY29sdW1uOiBudW1iZXIpOiBJdGVtVHlwZSB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Ghpc1trXTtcbiAgICAgICAgICBhcnJheXNbal1baV0gPSB0aGlzW2tdO1xuICAgICAgICAgIGsrKztcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIGFycmF5cztcbiAgICB9XG4gIH07XG59XG4iXX0=
//# sourceMappingURL=symmetric-grid.js.map

@@ -11,3 +11,5 @@ import type { ComplexView, ContainerView, PrimitiveView, ViewConstructor, ViewInstance } from "./view-types";

static getLength<T>(value: Array<T>): number;
static getOffset(index: number, view: DataView, start?: number): [start: number, length: number] | undefined;
static getSize(view: DataView, start?: number): number;
static indexOf<T>(value: T, view: DataView, startIndex?: number, startOffset?: number): number;
[Symbol.iterator](): Generator<ViewInstance<T> | undefined>;

@@ -17,4 +19,5 @@ at(index: number): T | undefined;

getLength(index: number): number;
getLayout(index: number): [number, number] | undefined;
getOffset(index: number): [number, number] | undefined;
getView(index: number): ViewInstance<T> | undefined;
indexOf(value: T, start?: number): number;
set(index: number, value: T): void;

@@ -21,0 +24,0 @@ setView(index: number, value: DataView): void;

export class VectorView extends DataView {
static View;
static viewLength = 0;
static maxView;
get size() {

@@ -13,7 +10,5 @@ return this.constructor.getSize(this);

for (let i = 0; i < size; i++) {
const offset = (i + 1) << 2;
const startOffset = view.getUint32(start + offset, true);
const end = view.getUint32(start + offset + 4, true);
array[i] = startOffset !== end
? View.decode(view, start + startOffset, end - startOffset)
const offset = this.getOffset(i, view, start);
array[i] = offset
? View.decode(view, start + offset[0], offset[1])
: undefined;

@@ -41,2 +36,3 @@ }

itemLength = View.getLength(value.length || 1);
// stop encoding if no more space is available
if (itemLength > availableSpace)

@@ -72,5 +68,29 @@ continue;

}
static getOffset(index, view, start = 0) {
const offset = start + ((index + 1) << 2);
const begin = view.getUint32(offset, true);
const end = view.getUint32(offset + 4, true);
if (begin === end)
return undefined;
return [begin, end - begin];
}
static getSize(view, start = 0) {
return view.getUint32(start, true);
}
static indexOf(value, view, startIndex = 0, startOffset = 0) {
const size = this.getSize(view, startOffset);
const valueView = this.View.from(value);
outer: for (let i = startIndex; i < size; i++) {
const offset = this.getOffset(i, view, startOffset);
if (!offset || offset[1] !== valueView.byteLength)
continue;
for (let j = 0; j < valueView.byteLength; j++) {
if (valueView.getUint8(j) !== view.getUint8(offset[0] + j)) {
continue outer;
}
}
return i;
}
return -1;
}
*[Symbol.iterator]() {

@@ -90,23 +110,16 @@ const { size } = this;

.View;
const layout = this.getLayout(index);
if (!layout)
const offset = this.getOffset(index);
if (!offset)
return undefined;
return View.decode(this, layout[0], layout[1]);
return View.decode(this, offset[0], offset[1]);
}
getLength(index) {
const layout = this.getLayout(index);
if (!layout)
return 0;
return layout[1];
const offset = this.getOffset(index);
return offset ? offset[1] : 0;
}
getLayout(index) {
getOffset(index) {
const length = this.getUint32(0, true);
if (index >= length)
return undefined;
const startOffset = (index + 1) << 2;
const start = this.getUint32(startOffset, true);
const end = this.getUint32(startOffset + 4, true);
if (start === end)
return undefined;
return [start, end - start];
return this.constructor.getOffset(index, this, 0);
}

@@ -116,20 +129,23 @@ getView(index) {

.View;
const layout = this.getLayout(index);
if (!layout)
const offset = this.getOffset(index);
if (!offset)
return undefined;
return new View(this.buffer, this.byteOffset + layout[0], layout[1]);
return new View(this.buffer, this.byteOffset + offset[0], offset[1]);
}
indexOf(value, start = 0) {
return this.constructor.indexOf(value, this, start, 0);
}
set(index, value) {
const View = this.constructor
.View;
const layout = this.getLayout(index);
if (!layout)
const offset = this.getOffset(index);
if (!offset)
return undefined;
View.encode(value, this, this.byteOffset + layout[0], layout[1]);
View.encode(value, this, this.byteOffset + offset[0], offset[1]);
}
setView(index, value) {
const layout = this.getLayout(index);
if (!layout)
const offset = this.getOffset(index);
if (!offset)
return undefined;
new Uint8Array(this.buffer, this.byteOffset + layout[0], layout[1]).set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
new Uint8Array(this.buffer, this.byteOffset + offset[0], offset[1]).set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
}

@@ -140,3 +156,9 @@ to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mZnNldCwgdmFsdWUuYnl0ZUxlbmd0aCksXG4gICAgKTtcbiAgfVxuXG4gIHRvSlNPTigpOiBBcnJheTxUIHwgdW5kZWZpbmVkPiB7XG4gICAgcmV0dXJuICh0aGlzLmNvbnN0cnVjdG9yIGFzIHR5cGVvZiBWZWN0b3JWaWV3KS5kZWNvZGUodGhpcywgMCk7XG4gIH1cbn1cbiJdfQ==
Object.defineProperty(VectorView, "viewLength", {
enumerable: true,
configurable: true,
writable: true,
value: 0
});
//# sourceMappingURL=vector-view.js.map

@@ -50,2 +50,11 @@ import { Constructor } from "./utility-types";

/**
* Returns the index within the view of the first occurrence
* of the specified value, starting the search at start.
* Returns -1 if the value is not found.
*
* @param value the to search for
* @return index of the value or -1 if not found
*/
indexOf(value: T, start?: number): number;
/**
* Sets a given JavaScript value to an item at a given index.

@@ -129,2 +138,3 @@ *

ObjectConstructor?: Constructor<T>;
View?: unknown;
new (...args: any[]): Instance;

@@ -189,5 +199,7 @@ /**

};
propertyNames?: ViewSchema<number> | ViewSchema<string>;
additionalProperties?: ViewSchema<T[keyof T]>;
type: [T] extends [number | bigint | undefined] ? "number" | "integer" : [T] extends [string | ArrayBufferLike | undefined] ? "string" : [T] extends [boolean | undefined] ? "boolean" : T extends Array<unknown> ? "array" : T extends object ? "object" : never;
btype?: T extends number ? ViewSchemaNumberType : T extends ArrayBufferLike ? "binary" : T extends Array<unknown> ? "vector" : T extends object ? "map" : never;
btype?: T extends number ? ViewSchemaNumberType : T extends ArrayBufferLike ? "binary" : T extends Array<unknown> ? "vector" : T extends object ? "map" | "dict" : never;
default?: T;
}
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlldy10eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInZpZXctdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8vIGRlbm8tbGludC1pZ25vc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W5kcyBbYm9vbGVhbiB8IHVuZGVmaW5lZF0gPyBcImJvb2xlYW5cIlxuICAgIDogVCBleHRlbmRzIEFycmF5PHVua25vd24+ID8gXCJhcnJheVwiXG4gICAgOiBUIGV4dGVuZHMgb2JqZWN0ID8gXCJvYmplY3RcIlxuICAgIDogbmV2ZXI7XG4gIGJ0eXBlPzogVCBleHRlbmRzIG51bWJlciA/IFZpZXdTY2hlbWFOdW1iZXJUeXBlXG4gICAgOiBUIGV4dGVuZHMgQXJyYXlCdWZmZXJMaWtlID8gXCJiaW5hcnlcIlxuICAgIDogVCBleHRlbmRzIEFycmF5PHVua25vd24+ID8gXCJ2ZWN0b3JcIlxuICAgIDogVCBleHRlbmRzIG9iamVjdCA/IFwibWFwXCJcbiAgICA6IG5ldmVyO1xuICBkZWZhdWx0PzogVDtcbn1cbiJdfQ==
//# sourceMappingURL=view-types.js.map

@@ -6,2 +6,3 @@ import type { ComplexView, ContainerView, PrimitiveView, ViewConstructor, ViewFieldLayout, ViewInstance, ViewLayout, ViewSchema } from "./view-types";

import { MapView } from "./map-view";
import { DictView } from "./dict-view";
import { TypedArrayView } from "./typed-array-view";

@@ -20,2 +21,3 @@ import { Constructor } from "./utility-types";

static MapClass: typeof MapView;
static DictClass: typeof DictView;
static _maxView: DataView;

@@ -35,2 +37,3 @@ static get maxView(): DataView;

static getObjectView<T extends object>(schema: ViewSchema<T>, constructor?: Constructor<T>): ViewConstructor<T, ComplexView<T>>;
static getDictView<T extends object>(schema: ViewSchema<T>): ViewConstructor<T, ComplexView<T>>;
static getSchemaId(schema: ViewSchema<any>): string;

@@ -37,0 +40,0 @@ static getSchemaOrdering(schema: ViewSchema<unknown>): Array<ViewSchema<object>>;

@@ -7,2 +7,3 @@ import { BooleanView } from "./boolean-view.js";

import { MapView } from "./map-view.js";
import { DictView } from "./dict-view.js";
import { StringView } from "./string-view.js";

@@ -30,7 +31,10 @@ import { TypedArrayView } from "./typed-array-view.js";

? this.getMapView(objectSchema, objectCtor)
: this.getObjectView(objectSchema, objectCtor);
: objectSchema.btype === "dict"
? this.getDictView(objectSchema)
: this.getObjectView(objectSchema, objectCtor);
// cache the view by id
this.Views.set(id, View);
// cache by tag if present
const tag = objectSchema.properties[this.tagName]?.default;
const tag = objectSchema.properties &&
objectSchema.properties[this.tagName]?.default;
if (typeof tag === "number") {

@@ -366,2 +370,31 @@ this.TaggedViews.set(tag, View);

}
static getDictView(schema) {
var _a;
const maxView = this.maxView;
const KeyView = this.getExistingView(schema.propertyNames);
const ValueView = this.getExistingView(schema.additionalProperties);
const KeysView = this.getArrayView(KeyView, schema.propertyNames?.maxLength);
const ValuesView = this.getVectorView(ValueView, maxView);
return _a = class extends this.DictClass {
},
Object.defineProperty(_a, "maxView", {
enumerable: true,
configurable: true,
writable: true,
value: maxView
}),
Object.defineProperty(_a, "KeysView", {
enumerable: true,
configurable: true,
writable: true,
value: KeysView
}),
Object.defineProperty(_a, "ValuesView", {
enumerable: true,
configurable: true,
writable: true,
value: ValuesView
}),
_a;
}
// deno-lint-ignore no-explicit-any

@@ -525,3 +558,9 @@ static getSchemaId(schema) {

});
Object.defineProperty(View, "DictClass", {
enumerable: true,
configurable: true,
writable: true,
value: DictView
});
//# sourceMappingURL=view.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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