@dra2020/baseclient 1.0.148 → 1.0.150

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.
@@ -29,6 +29,7 @@ export declare class Deadline {
29
29
  done(): boolean;
30
30
  }
31
31
  export declare function createGuid(): string;
32
+ export declare function isGuid(s: string): boolean;
32
33
  export declare function createKeyedGuid(key: string): string;
33
34
  export declare function guidKey(guid: string): string;
34
35
  export declare function sizeof(a: any): number;
package/lib/geo/geo.ts CHANGED
@@ -58,6 +58,7 @@ export function isValidId(col: GeoFeatureCollection): boolean
58
58
  for (let i = 0; i < col.features.length; i++)
59
59
  {
60
60
  let f = col.features[i];
61
+ if (typeof f.properties.id === 'number') f.properties.id = String(f.properties.id); // Fix old 2016_BG collections
61
62
  if (typeof f.properties.id !== 'string') return false; // id must be string
62
63
  if (set.has(f.properties.id)) return false; // id must be unique
63
64
  set.add(f.properties.id);
package/lib/util/util.ts CHANGED
@@ -132,6 +132,13 @@ export function createGuid(): string
132
132
  });
133
133
  }
134
134
 
135
+ const reGuid = /.*-.*-.*-.*-/;
136
+
137
+ export function isGuid(s: string): boolean
138
+ {
139
+ return reGuid.test(s) && s.length >= 36
140
+ }
141
+
135
142
  export function createKeyedGuid(key: string): string
136
143
  {
137
144
  return `xxxxxxxx-xxxx-${key}xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g, function(c) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.148",
3
+ "version": "1.0.150",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",