loudo-ds-lmap 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Entry, MapChange, MapRemove } from "loudo-ds-map-interfaces";
1
+ import { Entry, MapChange, MapInput, MapRemove } from "loudo-ds-map-interfaces";
2
2
  interface Bucket<K, V> {
3
3
  key: K;
4
4
  value: V;
@@ -8,7 +8,7 @@ interface Bucket<K, V> {
8
8
  chain: B<K, V>;
9
9
  }
10
10
  type B<K, V> = Bucket<K, V> | null;
11
- export interface HashConfig<K extends {}, V extends {}> {
11
+ export interface LMapConfig<K extends {}, V extends {}> {
12
12
  readonly load?: number;
13
13
  hashCode(key: K): number;
14
14
  keyEq?(key1: K, key2: K): boolean;
@@ -16,11 +16,11 @@ export interface HashConfig<K extends {}, V extends {}> {
16
16
  }
17
17
  export declare class LMap<K extends {}, V extends {}> {
18
18
  #private;
19
- readonly config: HashConfig<K, V>;
19
+ readonly config: LMapConfig<K, V>;
20
20
  private buckets;
21
21
  firstB: B<K, V>;
22
22
  lastB: B<K, V>;
23
- constructor(config: HashConfig<K, V>);
23
+ constructor(input: MapInput<K, V>, config: LMapConfig<K, V>);
24
24
  get size(): number;
25
25
  get first(): Entry<K, V> | undefined;
26
26
  get last(): Entry<K, V> | undefined;
@@ -34,7 +34,7 @@ export declare class LMap<K extends {}, V extends {}> {
34
34
  private grow;
35
35
  private bucket;
36
36
  put(key: K, value: V): V | undefined;
37
- remove(key: K): V | undefined;
37
+ removeKey(key: K): V | undefined;
38
38
  clear(): void;
39
39
  }
40
40
  export interface LMap<K extends {}, V extends {}> extends MapChange<K, V>, MapRemove<K, V> {
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var _LMap_size;
13
13
  import { mixin, toTin, OnlyError } from "loudo-ds-core";
14
14
  import { MapChange, MapRemove } from "loudo-ds-map-interfaces";
15
15
  export class LMap {
16
- constructor(config) {
16
+ constructor(input, config) {
17
17
  this.buckets = [];
18
18
  this.firstB = null;
19
19
  this.lastB = null;
@@ -22,6 +22,7 @@ export class LMap {
22
22
  for (let i = 0; i < 4; i++) {
23
23
  this.buckets.push(null);
24
24
  }
25
+ this.putAll(input);
25
26
  }
26
27
  get size() { return __classPrivateFieldGet(this, _LMap_size, "f"); }
27
28
  get first() { var _a; return (_a = this.firstB) !== null && _a !== void 0 ? _a : undefined; }
@@ -107,7 +108,7 @@ export class LMap {
107
108
  this.fire({ cleared: false, added: { elements: toTin([bucket]), at: undefined, count: 1 } });
108
109
  return undefined;
109
110
  }
110
- remove(key) {
111
+ removeKey(key) {
111
112
  var _a;
112
113
  const hash = this.config.hashCode(key);
113
114
  let prev = null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loudo-ds-lmap",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "Flexible loud map.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -33,6 +33,6 @@
33
33
  "vitest": "^2.1.4"
34
34
  },
35
35
  "dependencies": {
36
- "loudo-ds-map-interfaces": "^0.0.4"
36
+ "loudo-ds-map-interfaces": "^0.0.6"
37
37
  }
38
38
  }