loudo-ds-map-interfaces 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE.txt ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, p-jack
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # loudo-ds-map-interfaces
2
+
3
+ Provides mixins for maps.
@@ -0,0 +1,24 @@
1
+ import { Tin } from "loudo-ds-core";
2
+ export interface Entry<K extends {}, V extends {}> {
3
+ key: K;
4
+ value: V;
5
+ }
6
+ export declare abstract class BaseMap<K extends {}, V extends {}> {
7
+ abstract get(key: K): V | undefined;
8
+ abstract get keyEq(): (k1: K, k2: K) => boolean;
9
+ hasKey(key: K): boolean;
10
+ get keys(): Tin<K>;
11
+ get values(): Tin<V>;
12
+ }
13
+ export interface BaseMap<K extends {}, V extends {}> extends Tin<Entry<K, V>> {
14
+ }
15
+ export declare abstract class MapChange<K extends {}, V extends {}> {
16
+ abstract put(key: K): V | undefined;
17
+ }
18
+ export interface MapChange<K extends {}, V extends {}> extends BaseMap<K, V> {
19
+ }
20
+ export declare abstract class MapRemove<K extends {}, V extends {}> {
21
+ abstract remove(key: K): V | undefined;
22
+ }
23
+ export interface MapRemove<K extends {}, V extends {}> extends BaseMap<K, V> {
24
+ }
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import { Tin, mixin } from "loudo-ds-core";
2
+ export class BaseMap {
3
+ hasKey(key) { return this.get(key) !== undefined; }
4
+ get keys() { return this.map(x => x.key); }
5
+ get values() { return this.map(x => x.value); }
6
+ }
7
+ mixin(BaseMap, [Tin]);
8
+ export class MapChange {
9
+ }
10
+ mixin(MapChange, [BaseMap]);
11
+ export class MapRemove {
12
+ }
13
+ mixin(MapRemove, [BaseMap]);
14
+ //# sourceMappingURL=index.js.map
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "loudo-ds-map-interfaces",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "Core interfaces for loud maps (dictionaries.)",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "README.md",
10
+ "dist/index.js",
11
+ "dist/index.d.ts"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "prepare": "tsc",
16
+ "test": "vitest --coverage"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/p-jack/loudo-ds-core.git"
21
+ },
22
+ "author": "Paul Jack",
23
+ "license": "BSD-3-Clause",
24
+ "bugs": {
25
+ "url": "https://github.com/p-jack/loudo-ds-core/issues"
26
+ },
27
+ "homepage": "https://github.com/p-jack/loudo-ds-core#readme",
28
+ "devDependencies": {
29
+ "@vitest/coverage-v8": "^1.2.2",
30
+ "typescript": "^5.3.3",
31
+ "vitest": "^1.2.2"
32
+ },
33
+ "dependencies": {
34
+ "loudo-ds-core": "^0.0.20"
35
+ }
36
+ }