@dra2020/baseclient 1.0.133 → 1.0.134

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.
@@ -1203,6 +1203,10 @@ exports.FormatDetail = void 0;
1203
1203
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
1204
1204
  const reIdentifier = /\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g;
1205
1205
  const reParam = /^__\d+$/;
1206
+ function defaultNumberFormat(n) {
1207
+ return Util.precisionRound(n, 0).toLocaleString();
1208
+ }
1209
+ const DefaultDetailOptions = { numberFormat: defaultNumberFormat };
1206
1210
  class Evaluator {
1207
1211
  constructor(expr) {
1208
1212
  this.expr = expr;
@@ -1255,7 +1259,8 @@ class Evaluator {
1255
1259
  const reInvalidChars = /[\.\[\]\\]/;
1256
1260
  const reExpr = /^=(.*)$/;
1257
1261
  class FormatDetail {
1258
- constructor(pattern) {
1262
+ constructor(pattern, options) {
1263
+ this.options = Util.shallowAssignImmutable(DefaultDetailOptions, options);
1259
1264
  this._error = false;
1260
1265
  this.pattern = pattern.trim();
1261
1266
  let a = reExpr.exec(pattern);
@@ -1320,7 +1325,7 @@ class FormatDetail {
1320
1325
  n = e.eval(o);
1321
1326
  if (!this._error)
1322
1327
  this._error = e.error;
1323
- return Util.precisionRound(n, 0).toLocaleString();
1328
+ return this.options.numberFormat(n);
1324
1329
  }
1325
1330
  });
1326
1331
  return { n, v: av.join('') };