@dra2020/baseclient 1.0.86 → 1.0.88

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.
@@ -16,6 +16,8 @@ export declare class MultiBlockMapping {
16
16
  add(tag: string, bm: BlockMapping): void;
17
17
  remove(tag: string): void;
18
18
  map(blockid: string): string;
19
+ mapmain(blockid: string): string;
19
20
  rev(geoid: string): string[];
21
+ forEach(cb: (blockid: string) => void): void;
20
22
  }
21
23
  export {};
@@ -48,7 +48,8 @@ export class MultiBlockMapping
48
48
 
49
49
  map(blockid: string): string
50
50
  {
51
- for (let i = 0; i < this.entries.length; i++)
51
+ // Walk backwards to pick up overrides first
52
+ for (let i = this.entries.length-1; i >= 0; i--)
52
53
  {
53
54
  let e = this.entries[i];
54
55
  if (e.bm[blockid])
@@ -57,6 +58,11 @@ export class MultiBlockMapping
57
58
  return undefined;
58
59
  }
59
60
 
61
+ mapmain(blockid: string): string
62
+ {
63
+ return this.entries.length ? this.entries[0].bm[blockid] : undefined;
64
+ }
65
+
60
66
  rev(geoid: string): string[]
61
67
  {
62
68
  for (let i = 0; i < this.entries.length; i++)
@@ -69,4 +75,11 @@ export class MultiBlockMapping
69
75
  }
70
76
  return undefined;
71
77
  }
78
+
79
+ // Just walks first map
80
+ forEach(cb: (blockid: string) => void): void
81
+ {
82
+ if (this.entries.length)
83
+ Object.keys(this.entries[0].bm).forEach(blockid => cb(blockid));
84
+ }
72
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",