@dra2020/baseclient 1.0.150 → 1.0.151

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.
@@ -84,7 +84,7 @@ export class MultiBlockMapping
84
84
 
85
85
  rev(geoid: string): string[]
86
86
  {
87
- for (let i = 0; i < this.entries.length; i++)
87
+ for (let i = this.entries.length-1; i >= 0; i--)
88
88
  {
89
89
  let e = this.entries[i];
90
90
  if (! e.rbm)
@@ -102,14 +102,21 @@ export class MultiBlockMapping
102
102
  Object.keys(this.entries[0].bm).forEach(blockid => cb(blockid));
103
103
  }
104
104
 
105
- // Just walks first map
105
+ // Walk maps in reverse order, careful to not invoke on same geoid
106
106
  forEachRev(cb: (geoidid: string, blocks: string[]) => void): void
107
107
  {
108
- for (let i = 0; i < this.entries.length; i++)
108
+ let seen = new Set<string>();
109
+ for (let i = this.entries.length-1; i >= 0; i--)
109
110
  {
110
111
  let e = this.entries[i];
111
112
  if (! e.rbm) e.rbm = reverseBlockMapping(e.bm);
112
- Object.keys(e.rbm).forEach(geoid => cb(geoid, e.rbm[geoid]));
113
+ Object.keys(e.rbm).forEach(geoid => {
114
+ if (! seen.has(geoid))
115
+ {
116
+ seen.add(geoid);
117
+ cb(geoid, e.rbm[geoid]);
118
+ }
119
+ });
113
120
  }
114
121
  }
115
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",