MCPcopy Create free account
hub / github.com/p2r3/convert / constructor

Method constructor

src/PriorityQueue.ts:6–14  ·  view source on GitHub ↗
(initialCapacity?: number, comparator?: (val: T, parent: T) => number)

Source from the content-addressed store, hash-verified

4 private _comparator: ((val: T, parent: T) => number) | null;
5
6 constructor(initialCapacity?: number, comparator?: (val: T, parent: T) => number) {
7 const cap = initialCapacity ?? 11;
8 const com = comparator ?? null;
9 if (cap < 1) {
10 throw new Error('initial capacity must be greater than or equal to 1');
11 }
12 this._queue = new Array<T>(cap);
13 this._comparator = com;
14 }
15
16 private grow() {
17 const oldCapacity = this._size;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected