blob: 461f528b8be8e528f24907bde145cc1ed9435537 (
plain)
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
|
import { NamespacedValue } from "./NamespacedValue";
import { Optional } from "./types";
declare type NS = NamespacedValue<string, string>;
/**
* A `Map` implementation which accepts a NamespacedValue as a key, and arbitrary value. The
* namespaced value must be a string type.
*/
export declare class NamespacedMap<V> {
protected internalMap: Map<string, V>;
/**
* Creates a new map with optional seed data.
* @param {Array<[NS, V]>} initial The seed data.
*/
constructor(initial?: [NS, V][]);
/**
* Gets a value from the map. If the value does not exist under
* either namespace option, falsy is returned.
* @param {NS} key The key.
* @returns {Optional<V>} The value, or falsy.
*/
get(key: NS): Optional<V>;
/**
* Sets a value in the map.
* @param {NS} key The key.
* @param {V} val The value.
*/
set(key: NS, val: V): void;
/**
* Determines if any of the valid namespaced values are present
* in the map.
* @param {NS} key The key.
* @returns {boolean} True if present.
*/
has(key: NS): boolean;
/**
* Removes all the namespaced values from the map.
* @param {NS} key The key.
*/
delete(key: NS): void;
/**
* Determines if the map contains a specific namespaced value
* instead of the parent NS type.
* @param {string} key The key.
* @returns {boolean} True if present.
*/
hasNamespaced(key: string): boolean;
/**
* Gets a specific namespaced value from the map instead of the
* parent NS type. Returns falsy if not found.
* @param {string} key The key.
* @returns {Optional<V>} The value, or falsy.
*/
getNamespaced(key: string): Optional<V>;
}
export {};
|