graph-typed 1.44.1 → 1.45.0

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.
@@ -1 +1,17 @@
1
- export {};
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
+ export type HashMapLinkedNode<K, V> = {
13
+ key: K
14
+ value: V
15
+ next: HashMapLinkedNode<K, V>
16
+ prev: HashMapLinkedNode<K, V>
17
+ }
@@ -1 +1,8 @@
1
+ export * from './coordinate-map';
2
+ export * from './coordinate-set';
3
+ export * from './hash-map';
4
+ export * from './hash-table';
5
+ export * from './tree-map';
6
+ export * from './tree-set';
7
+
1
8
  export type HashFunction<K> = (key: K) => number;
@@ -84,3 +84,16 @@ export const getMSB = (value: number): number => {
84
84
  }
85
85
  return 1 << (31 - Math.clz32(value));
86
86
  };
87
+
88
+ export const rangeCheck = (index: number, min: number, max: number, message = 'Index out of bounds.'): void => {
89
+ if (index < min || index > max) throw new RangeError(message);
90
+ }
91
+
92
+ export const throwRangeError = (message = 'The value is off-limits.'): void => {
93
+ throw new RangeError(message);
94
+ }
95
+
96
+ export const isObjOrFunc = (input: unknown): input is Record<string, unknown> | ((...args: any[]) => any) => {
97
+ const inputType = typeof input;
98
+ return (inputType === 'object' && input !== null) || inputType === 'function';
99
+ }