-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeakStrongMap.d.mts
69 lines (69 loc) · 2.64 KB
/
WeakStrongMap.d.mts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
declare class WeakStrongMap<__MK0__ extends object, __MK1__, __V__> {
#private;
constructor(iterable?: [__MK0__, __MK1__, __V__][]);
/**
* Delete an element from the collection by the given key sequence.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @returns {boolean} True if we found the value and deleted it.
* @public
*/
delete(weakKey: __MK0__, strongKey: __MK1__): boolean;
/**
* Get a value for a key set.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @returns {*?} The value. Undefined if it isn't in the collection.
* @public
*/
get(weakKey: __MK0__, strongKey: __MK1__): __V__ | undefined;
/**
* Provide a default value for .getDefault().
*
* @callback __WeakStrongMap_GetDefaultCallback__
* @returns {*} The value.
*/
/**
* Guarantee a value for a key set.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @param {__WeakStrongMap_GetDefaultCallback__} __default__ A function to provide a default value if necessary.
* @returns {*} The value.
* @public
*/
getDefault(weakKey: __MK0__, strongKey: __MK1__, __default__: () => __V__): __V__;
/**
* Report if the collection has a value for a key set.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @returns {boolean} True if the key set refers to a value in the collection.
* @public
*/
has(weakKey: __MK0__, strongKey: __MK1__): boolean;
/**
* Determine if a set of keys is valid.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @returns {boolean} True if the validation passes, false if it doesn't.
* @public
*/
isValidKey(weakKey: __MK0__, strongKey: __MK1__): boolean;
/**
* Set a value for a key set.
*
* @param {object} weakKey The weakly held key.
* @param {*} strongKey The strongly held key.
* @param {*} value The value.
* @returns {WeakStrongMap} This collection.
* @public
*/
set(weakKey: __MK0__, strongKey: __MK1__, value: __V__): this;
[Symbol.toStringTag]: string;
}
export declare type ReadonlyWeakStrongMap<__MK0__ extends object, __MK1__, __V__> = Pick<WeakStrongMap<__MK0__, __MK1__, __V__>, "get" | "has" | "isValidKey">;
export default WeakStrongMap;