@dra2020/baseclient 1.0.2 → 1.0.3

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/geo/geo.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare class GeoMultiCollection {
51
51
  showAll(): void;
52
52
  get length(): number;
53
53
  nthFeature(n: number): GeoFeature;
54
+ nthFilteredFeature(n: number, cb: (f: GeoFeature) => boolean): GeoFeature;
54
55
  forEach(cb: FeatureFunc): void;
55
56
  map(cb: (f: GeoFeature) => GeoFeature): GeoFeature[];
56
57
  isHidden(id: string): boolean;
package/lib/geo/geo.ts CHANGED
@@ -325,12 +325,37 @@ export class GeoMultiCollection
325
325
  return found;
326
326
  }
327
327
 
328
- forEach(cb: FeatureFunc): void
328
+ nthFilteredFeature(n: number, cb: (f: GeoFeature) => boolean)
329
329
  {
330
+ let found: GeoFeature;
331
+
330
332
  this.forEachEntry(e => {
333
+ if (found) return;
331
334
  let col = this._col(e);
332
335
  if (col)
333
- col.features.forEach(f => { if (this.hidden[f.properties.id] === undefined) cb(f) })
336
+ for (let i = 0; !found && i < col.features.length; i++)
337
+ {
338
+ let f = col.features[i];
339
+ if (this.hidden[f.properties.id] === undefined && cb(f))
340
+ {
341
+ if (n === 0)
342
+ {
343
+ found = f;
344
+ break;
345
+ }
346
+ n--;
347
+ }
348
+ }
349
+ });
350
+ return found;
351
+ }
352
+
353
+ forEach(cb: FeatureFunc): void
354
+ {
355
+ this.forEachEntry(e => {
356
+ let col = this._col(e);
357
+ if (e.col)
358
+ e.col.features.forEach(f => { if (this.hidden[f.properties.id] === undefined) cb(f) })
334
359
  });
335
360
  }
336
361
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",