max-heap-typed 2.1.2 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +56 -53
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +998 -0
- package/dist/cjs-legacy/index.cjs.map +1 -0
- package/dist/esm/index.mjs +56 -53
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +991 -0
- package/dist/esm-legacy/index.mjs.map +1 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +57 -3
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +65 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +61 -5
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +58 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +59 -4
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +57 -3
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +66 -3
- package/dist/types/types/data-structures/base/base.d.ts +1 -1
- package/package.json +20 -2
- package/src/data-structures/base/iterable-entry-base.ts +4 -4
- package/src/data-structures/binary-tree/avl-tree-counter.ts +103 -12
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +116 -12
- package/src/data-structures/binary-tree/avl-tree.ts +109 -16
- package/src/data-structures/binary-tree/binary-tree.ts +3 -2
- package/src/data-structures/binary-tree/bst.ts +104 -12
- package/src/data-structures/binary-tree/red-black-tree.ts +110 -19
- package/src/data-structures/binary-tree/tree-counter.ts +102 -11
- package/src/data-structures/binary-tree/tree-multi-map.ts +124 -12
- package/src/data-structures/graph/abstract-graph.ts +8 -8
- package/src/data-structures/graph/directed-graph.ts +5 -5
- package/src/data-structures/graph/undirected-graph.ts +5 -5
- package/src/data-structures/hash/hash-map.ts +4 -4
- package/src/types/data-structures/base/base.ts +1 -1
- package/tsup.node.config.js +40 -6
|
@@ -36,11 +36,11 @@ export class UndirectedEdge<E = number> extends AbstractEdge<E> {
|
|
|
36
36
|
* @example examples will be generated by unit test
|
|
37
37
|
*/
|
|
38
38
|
export class UndirectedGraph<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
V = any,
|
|
40
|
+
E = any,
|
|
41
|
+
VO extends UndirectedVertex<V> = UndirectedVertex<V>,
|
|
42
|
+
EO extends UndirectedEdge<E> = UndirectedEdge<E>
|
|
43
|
+
>
|
|
44
44
|
extends AbstractGraph<V, E, VO, EO>
|
|
45
45
|
implements IGraph<V, E, VO, EO>
|
|
46
46
|
{
|
|
@@ -290,7 +290,7 @@ export class HashMap<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
290
290
|
map<VM>(callbackfn: EntryCallback<K, V, VM>, thisArg?: any): any {
|
|
291
291
|
const out = this._createLike<K, VM, [K, VM]>();
|
|
292
292
|
let index = 0;
|
|
293
|
-
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg,
|
|
293
|
+
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg, value, key, index++, this));
|
|
294
294
|
return out;
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -305,7 +305,7 @@ export class HashMap<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
305
305
|
filter(predicate: EntryCallback<K, V, boolean>, thisArg?: any): any {
|
|
306
306
|
const out = this._createLike<K, V, [K, V]>();
|
|
307
307
|
let index = 0;
|
|
308
|
-
for (const [key, value] of this) if (predicate.call(thisArg,
|
|
308
|
+
for (const [key, value] of this) if (predicate.call(thisArg, value, key, index++, this)) out.set(key, value);
|
|
309
309
|
return out;
|
|
310
310
|
}
|
|
311
311
|
|
|
@@ -677,7 +677,7 @@ export class LinkedHashMap<K = any, V = any, R = [K, V]> extends IterableEntryBa
|
|
|
677
677
|
const out = this._createLike<K, V, [K, V]>();
|
|
678
678
|
let index = 0;
|
|
679
679
|
for (const [key, value] of this) {
|
|
680
|
-
if (predicate.call(thisArg,
|
|
680
|
+
if (predicate.call(thisArg, value, key, index, this)) out.set(key, value);
|
|
681
681
|
index++;
|
|
682
682
|
}
|
|
683
683
|
return out;
|
|
@@ -696,7 +696,7 @@ export class LinkedHashMap<K = any, V = any, R = [K, V]> extends IterableEntryBa
|
|
|
696
696
|
const out = this._createLike<MK, MV, [MK, MV]>();
|
|
697
697
|
let index = 0;
|
|
698
698
|
for (const [key, value] of this) {
|
|
699
|
-
const [newKey, newValue] = callback.call(thisArg,
|
|
699
|
+
const [newKey, newValue] = callback.call(thisArg, value, key, index, this);
|
|
700
700
|
out.set(newKey, newValue);
|
|
701
701
|
index++;
|
|
702
702
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IterableElementBase, IterableEntryBase } from '../../../data-structures';
|
|
2
2
|
import { LinearBase } from '../../../data-structures/base/linear-base';
|
|
3
3
|
|
|
4
|
-
export type EntryCallback<K, V, R> = (
|
|
4
|
+
export type EntryCallback<K, V, R> = (value: V, key: K, index: number, original: IterableEntryBase<K, V>) => R;
|
|
5
5
|
export type ElementCallback<E, R, RT> = (element: E, index: number, original: IterableElementBase<E, R>) => RT;
|
|
6
6
|
export type ReduceEntryCallback<K, V, R> = (
|
|
7
7
|
accumulator: R,
|
package/tsup.node.config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from "tsup";
|
|
2
2
|
|
|
3
3
|
export default defineConfig([
|
|
4
|
-
// ESM
|
|
4
|
+
// ESM (modern) - ES2022
|
|
5
5
|
{
|
|
6
6
|
entry: { index: "src/index.ts" },
|
|
7
7
|
format: ["esm"],
|
|
@@ -12,13 +12,30 @@ export default defineConfig([
|
|
|
12
12
|
keepNames: true,
|
|
13
13
|
treeshake: true,
|
|
14
14
|
clean: true,
|
|
15
|
+
target: "es2022",
|
|
16
|
+
outExtension() {
|
|
17
|
+
return { js: ".mjs" };
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// ESM (legacy) - ES2018
|
|
22
|
+
{
|
|
23
|
+
entry: { index: "src/index.ts" },
|
|
24
|
+
format: ["esm"],
|
|
25
|
+
outDir: "dist/esm-legacy",
|
|
26
|
+
splitting: false,
|
|
27
|
+
sourcemap: true,
|
|
28
|
+
minify: false,
|
|
29
|
+
keepNames: true,
|
|
30
|
+
treeshake: true,
|
|
31
|
+
clean: false,
|
|
15
32
|
target: "es2018",
|
|
16
33
|
outExtension() {
|
|
17
|
-
return { js: ".mjs" }
|
|
18
|
-
}
|
|
34
|
+
return { js: ".mjs" };
|
|
35
|
+
}
|
|
19
36
|
},
|
|
20
37
|
|
|
21
|
-
// CJS
|
|
38
|
+
// CJS (modern) - ES2022
|
|
22
39
|
{
|
|
23
40
|
entry: { index: "src/index.ts" },
|
|
24
41
|
format: ["cjs"],
|
|
@@ -29,9 +46,26 @@ export default defineConfig([
|
|
|
29
46
|
keepNames: true,
|
|
30
47
|
treeshake: true,
|
|
31
48
|
clean: false,
|
|
32
|
-
target: "
|
|
49
|
+
target: "es2022",
|
|
33
50
|
outExtension() {
|
|
34
51
|
return { js: ".cjs" };
|
|
35
|
-
}
|
|
52
|
+
}
|
|
36
53
|
},
|
|
54
|
+
|
|
55
|
+
// CJS (legacy) - ES2018
|
|
56
|
+
{
|
|
57
|
+
entry: { index: "src/index.ts" },
|
|
58
|
+
format: ["cjs"],
|
|
59
|
+
outDir: "dist/cjs-legacy",
|
|
60
|
+
splitting: false,
|
|
61
|
+
sourcemap: true,
|
|
62
|
+
minify: false,
|
|
63
|
+
keepNames: true,
|
|
64
|
+
treeshake: true,
|
|
65
|
+
clean: false,
|
|
66
|
+
target: "es2018",
|
|
67
|
+
outExtension() {
|
|
68
|
+
return { js: ".cjs" };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
37
71
|
]);
|