forked from Yomguithereal/mnemonist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuzzy-multi-map.d.ts
36 lines (31 loc) · 1.07 KB
/
fuzzy-multi-map.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Mnemonist FuzzyMultiMap Typings
* ================================
*/
type HashFunction<K> = (key: any) => K;
type HashFunctionsTuple<K> = [HashFunction<K>, HashFunction<K>];
type FuzzyMultiMapContainer = ArrayConstructor | SetConstructor;
export default class FuzzyMultiMap<K, V> implements Iterable<V> {
// Members
dimension: number;
size: number;
// Constructor
constructor(hashFunction: HashFunction<K>, Container?: FuzzyMultiMapContainer);
constructor(hashFunctions: HashFunctionsTuple<K>, Container?: FuzzyMultiMapContainer);
// Methods
clear(): void;
add(value: V): this;
set(key: K, value: V): this;
get(key: any): Array<V> | Set<V> | undefined;
has(key: any): boolean;
forEach(callback: (value: V, key: V) => void, scope?: any): void;
values(): IterableIterator<V>;
[Symbol.iterator](): IterableIterator<V>;
inspect(): any;
// Statics
static from<I, J>(
iterable: Iterable<[I, J]> | {[key: string]: J},
hashFunction: HashFunction<I> | HashFunctionsTuple<I>,
Container?: FuzzyMultiMapContainer
): FuzzyMultiMap<I, J>;
}