binary-tree-typed 2.2.5 → 2.2.7
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 +8 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +8 -2
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +8 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +8 -2
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +14 -57
- package/dist/types/data-structures/binary-tree/bst.d.ts +46 -126
- package/dist/umd/binary-tree-typed.js +8 -2
- package/dist/umd/binary-tree-typed.js.map +1 -1
- package/dist/umd/binary-tree-typed.min.js +3 -3
- package/dist/umd/binary-tree-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/index.ts +2 -4
- package/src/data-structures/base/iterable-entry-base.ts +9 -0
- package/src/data-structures/binary-tree/binary-tree.ts +67 -0
- package/src/data-structures/binary-tree/bst.ts +295 -89
|
@@ -996,6 +996,14 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
996
996
|
}
|
|
997
997
|
return accumulator;
|
|
998
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* Converts data structure to `[key, value]` pairs.
|
|
1001
|
+
* @returns Array of entries.
|
|
1002
|
+
* @remarks Time O(n), Space O(n)
|
|
1003
|
+
*/
|
|
1004
|
+
toArray() {
|
|
1005
|
+
return [...this];
|
|
1006
|
+
}
|
|
999
1007
|
/**
|
|
1000
1008
|
* Visualize the iterable as an array of `[key, value]` pairs (or a custom string).
|
|
1001
1009
|
* @returns Array of entries (default) or a string.
|
|
@@ -1027,8 +1035,6 @@ var _Range = class _Range {
|
|
|
1027
1035
|
this.high = high;
|
|
1028
1036
|
this.includeLow = includeLow;
|
|
1029
1037
|
this.includeHigh = includeHigh;
|
|
1030
|
-
if (!(isComparable(low) && isComparable(high))) throw new RangeError("low or high is not comparable");
|
|
1031
|
-
if (low > high) throw new RangeError("low must be less than or equal to high");
|
|
1032
1038
|
}
|
|
1033
1039
|
// Determine whether a key is within the range
|
|
1034
1040
|
isInRange(key, comparator) {
|