min-heap-typed 1.45.3 → 1.46.2
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/data-structures/hash/hash-map.d.ts +6 -5
- package/dist/data-structures/hash/hash-map.js +9 -6
- package/dist/data-structures/heap/heap.d.ts +59 -47
- package/dist/data-structures/heap/heap.js +133 -123
- package/dist/data-structures/queue/deque.d.ts +483 -114
- package/dist/data-structures/queue/deque.js +921 -183
- package/dist/types/data-structures/hash/hash-map.d.ts +0 -9
- package/dist/types/helpers.d.ts +11 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +3 -1
- package/package.json +2 -2
- package/src/data-structures/hash/hash-map.ts +11 -7
- package/src/data-structures/heap/heap.ts +132 -128
- package/src/data-structures/queue/deque.ts +976 -170
- package/src/types/data-structures/hash/hash-map.ts +0 -11
- package/src/types/helpers.ts +15 -0
- package/src/utils/utils.ts +2 -0
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
export const enum IterateDirection {
|
|
2
|
-
DEFAULT = 0,
|
|
3
|
-
REVERSE = 1
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export type HashMapOptions<T> = {
|
|
7
|
-
sizeFunction?: number | (() => number);
|
|
8
|
-
fixedLength?: number;
|
|
9
|
-
forEach: (callback: (el: T) => void) => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
1
|
export type HashMapLinkedNode<K, V> = {
|
|
13
2
|
key: K;
|
|
14
3
|
value: V;
|
package/src/types/helpers.ts
CHANGED
|
@@ -9,3 +9,18 @@ export enum CP {
|
|
|
9
9
|
eq = 'eq',
|
|
10
10
|
gt = 'gt'
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export const enum IterateDirection {
|
|
14
|
+
DEFAULT = 0,
|
|
15
|
+
REVERSE = 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface IterableWithSize<T> extends Iterable<T> {
|
|
19
|
+
size: number | ((...args: any[]) => number);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IterableWithLength<T> extends Iterable<T> {
|
|
23
|
+
length: number | ((...args: any[]) => number);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T>
|
package/src/utils/utils.ts
CHANGED
|
@@ -97,3 +97,5 @@ export const isObjOrFunc = (input: unknown): input is Record<string, unknown> |
|
|
|
97
97
|
const inputType = typeof input;
|
|
98
98
|
return (inputType === 'object' && input !== null) || inputType === 'function';
|
|
99
99
|
};
|
|
100
|
+
|
|
101
|
+
export const calcMinUnitsRequired = (totalQuantity: number, unitSize: number) => Math.floor((totalQuantity + unitSize - 1) / unitSize)
|