loudo-ds-map-interfaces 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +7 -4
- package/dist/index.js +11 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Tin } from "loudo-ds-core";
|
1
|
+
import { Loud, Tin } from "loudo-ds-core";
|
2
2
|
export interface Entry<K extends {}, V extends {}> {
|
3
3
|
key: K;
|
4
4
|
value: V;
|
@@ -6,6 +6,8 @@ export interface Entry<K extends {}, V extends {}> {
|
|
6
6
|
export declare abstract class BaseMap<K extends {}, V extends {}> {
|
7
7
|
abstract get(key: K): V | undefined;
|
8
8
|
abstract get keyEq(): (k1: K, k2: K) => boolean;
|
9
|
+
abstract get valueEq(): (v1: V, v2: V) => boolean;
|
10
|
+
get eq(): (e1: Entry<K, V>, e2: Entry<K, V>) => boolean;
|
9
11
|
hasKey(key: K): boolean;
|
10
12
|
get keys(): Tin<K>;
|
11
13
|
get values(): Tin<V>;
|
@@ -13,12 +15,13 @@ export declare abstract class BaseMap<K extends {}, V extends {}> {
|
|
13
15
|
export interface BaseMap<K extends {}, V extends {}> extends Tin<Entry<K, V>> {
|
14
16
|
}
|
15
17
|
export declare abstract class MapChange<K extends {}, V extends {}> {
|
16
|
-
abstract put(key: K): V | undefined;
|
18
|
+
abstract put(key: K, value: V): V | undefined;
|
17
19
|
}
|
18
|
-
export interface MapChange<K extends {}, V extends {}> extends BaseMap<K, V
|
20
|
+
export interface MapChange<K extends {}, V extends {}> extends BaseMap<K, V>, Loud<Entry<K, V>> {
|
19
21
|
}
|
20
22
|
export declare abstract class MapRemove<K extends {}, V extends {}> {
|
21
23
|
abstract remove(key: K): V | undefined;
|
24
|
+
abstract clear(): void;
|
22
25
|
}
|
23
|
-
export interface MapRemove<K extends {}, V extends {}> extends BaseMap<K, V
|
26
|
+
export interface MapRemove<K extends {}, V extends {}> extends BaseMap<K, V>, Loud<Entry<K, V>> {
|
24
27
|
}
|
package/dist/index.js
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
import { Tin, mixin } from "loudo-ds-core";
|
1
|
+
import { Loud, Tin, mixin } from "loudo-ds-core";
|
2
2
|
export class BaseMap {
|
3
|
+
get eq() {
|
4
|
+
const me = this;
|
5
|
+
return (e1, e2) => {
|
6
|
+
if (!me.keyEq(e1.key, e2.key))
|
7
|
+
return false;
|
8
|
+
return me.valueEq(e1.value, e2.value);
|
9
|
+
};
|
10
|
+
}
|
3
11
|
hasKey(key) { return this.get(key) !== undefined; }
|
4
12
|
get keys() { return this.map(x => x.key); }
|
5
13
|
get values() { return this.map(x => x.value); }
|
@@ -7,8 +15,8 @@ export class BaseMap {
|
|
7
15
|
mixin(BaseMap, [Tin]);
|
8
16
|
export class MapChange {
|
9
17
|
}
|
10
|
-
mixin(MapChange, [BaseMap]);
|
18
|
+
mixin(MapChange, [BaseMap, Loud]);
|
11
19
|
export class MapRemove {
|
12
20
|
}
|
13
|
-
mixin(MapRemove, [BaseMap]);
|
21
|
+
mixin(MapRemove, [BaseMap, Loud]);
|
14
22
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "loudo-ds-map-interfaces",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.4",
|
5
5
|
"description": "Core interfaces for loud maps (dictionaries.)",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"types": "dist/index.d.ts",
|
@@ -31,6 +31,6 @@
|
|
31
31
|
"vitest": "^1.2.2"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"loudo-ds-core": "^0.0.
|
34
|
+
"loudo-ds-core": "^0.0.24"
|
35
35
|
}
|
36
36
|
}
|