@dra2020/baseclient 1.0.134 → 1.0.136

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.
@@ -1175,7 +1175,7 @@ __exportStar(__webpack_require__(/*! ./detail */ "./lib/detail/detail.ts"), expo
1175
1175
  // The formatting string is a statement of the form:
1176
1176
  // =expr
1177
1177
  // Expr can be an arithmetic expression using +-/*()?: as operators and variables are the field
1178
- // names of properties on the object passed in. The special field name _tot represents the
1178
+ // names of properties on the object passed in. The special field name Tot represents the
1179
1179
  // total of all properties. The expression may also include double-quoted strings that are
1180
1180
  // passed through (e.g. for use as labels = area" sqm")
1181
1181
  //
@@ -1295,19 +1295,17 @@ class FormatDetail {
1295
1295
  }
1296
1296
  get error() { return this._error; }
1297
1297
  static prepare(o) {
1298
- if (o) {
1299
- // Make sure there is a total field
1298
+ if (o && o.Tot === undefined && o.Total === undefined) {
1299
+ // Add a total field
1300
+ let t = 0;
1301
+ Object.keys(o).forEach((k) => {
1302
+ let v = o[k];
1303
+ if (!isNaN(v) && typeof v === 'number')
1304
+ t += v;
1305
+ });
1300
1306
  o = Util.deepCopy(o);
1301
- if (o['Tot'] !== undefined)
1302
- o['_tot'] = o['Tot'];
1303
- else {
1304
- let t = 0;
1305
- Object.values(o).forEach((v) => {
1306
- if (!isNaN(v) && typeof v === 'number')
1307
- t += v;
1308
- });
1309
- o['_tot'] = t;
1310
- }
1307
+ o.Tot = t;
1308
+ o.Total = t;
1311
1309
  }
1312
1310
  return o;
1313
1311
  }
@@ -11682,7 +11680,7 @@ exports.IndexedArray = IndexedArray;
11682
11680
 
11683
11681
 
11684
11682
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11685
- exports.wrapLon = exports.rad2deg = exports.deg2rad = exports.distance = exports.toRGBAIntensity = exports.toRGBA = exports.toHex = exports.hashObject = exports.hash = exports.percentString = exports.precisionRound = exports.deepAccum = exports.deepCopy = exports.shallowEqual = exports.shallowAssignImmutable = exports.shallowDelete = exports.shallowAssign = exports.shallowCopy = exports.textToHtml = exports.recentDate = exports.relativeDate = exports.prettyDate = exports.deepEqual = exports.partialEqual = exports.nthKey = exports.nthProperty = exports.countKeys = exports.isEmpty = exports.depthof = exports.sizeof = exports.guidKey = exports.createKeyedGuid = exports.createGuid = exports.Deadline = exports.MultiTimer = exports.Elapsed = exports.Now = void 0;
11683
+ exports.toSafeNumber = exports.toNumber = exports.isNumber = exports.wrapLon = exports.rad2deg = exports.deg2rad = exports.distance = exports.toRGBAIntensity = exports.toRGBA = exports.toHex = exports.hashObject = exports.hash = exports.percentString = exports.precisionRound = exports.deepAccum = exports.deepCopy = exports.shallowEqual = exports.shallowAssignImmutable = exports.shallowDelete = exports.shallowAssign = exports.shallowCopy = exports.textToHtml = exports.recentDate = exports.relativeDate = exports.prettyDate = exports.deepEqual = exports.partialEqual = exports.nthKey = exports.nthProperty = exports.countKeys = exports.isEmpty = exports.depthof = exports.sizeof = exports.guidKey = exports.createKeyedGuid = exports.createGuid = exports.Deadline = exports.MultiTimer = exports.Elapsed = exports.Now = void 0;
11686
11684
  function Now() { return (new Date()).toJSON(); }
11687
11685
  exports.Now = Now;
11688
11686
  // polyfill
@@ -12301,6 +12299,22 @@ function wrapLon(lon) {
12301
12299
  return lon - (worlds * 360);
12302
12300
  }
12303
12301
  exports.wrapLon = wrapLon;
12302
+ let reNumber = /^\s*-?\d+(\.\d+)?([eE][+-]?\d+)?\s*$/;
12303
+ function isNumber(s) { return !!s && reNumber.test(s); }
12304
+ exports.isNumber = isNumber;
12305
+ function toNumber(a) {
12306
+ if (typeof a === 'number')
12307
+ return a;
12308
+ if (typeof a === 'string' && !isNumber(a))
12309
+ return NaN;
12310
+ return Number(a);
12311
+ }
12312
+ exports.toNumber = toNumber;
12313
+ function toSafeNumber(a) {
12314
+ let n = toNumber(a);
12315
+ return (isNaN(n) || typeof n !== 'number') ? 0 : n;
12316
+ }
12317
+ exports.toSafeNumber = toSafeNumber;
12304
12318
 
12305
12319
 
12306
12320
  /***/ }),