@dra2020/baseclient 1.0.145 → 1.0.147

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.
@@ -14,8 +14,8 @@
14
14
  import * as Util from '../util/all';
15
15
  //import { Util } from '@dra2020/baseclient';
16
16
 
17
- const reIdentifier = /\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g;
18
- const reIdentifierOrString = /([a-zA-Z_$][a-zA-Z0-9_$]*)|(['"])(?:(?=(\\?))\3.)*?\2/g;
17
+ const reIdentifierOrStringOrNumber = /([a-zA-Z0-9_$][a-zA-Z0-9_$]*)|(['"])(?:(?=(\\?))\3.)*?\2/g;
18
+ const reNumber = /[0-9][0-9]*/;
19
19
  const reParam = /^__\d+$/;
20
20
  const reString = /^['"]/;
21
21
 
@@ -73,10 +73,12 @@ class Evaluator
73
73
  let safenames = names.map(n => namemap[n]);
74
74
 
75
75
  // Replace valid identifiers with safe version
76
- safeexpr = safeexpr.replace(reIdentifierOrString,
76
+ safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber,
77
77
  (match) => {
78
78
  if (namemap[match])
79
79
  return namemap[match];
80
+ else if (reNumber.test(match))
81
+ return match;
80
82
  else if (match === '__format' || reString.test(match))
81
83
  return match;
82
84
  else
@@ -87,9 +89,12 @@ class Evaluator
87
89
  });
88
90
 
89
91
  // Remove any identifiers that aren't the simple parameters to prevent out-of-sandbox execution
90
- safeexpr = safeexpr.replace(reIdentifierOrString,
92
+ safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber,
91
93
  (match) => {
92
- let valid = reParam.test(match) || match === '__format' || reString.test(match);
94
+ let valid = reParam.test(match)
95
+ || match === '__format'
96
+ || reString.test(match)
97
+ || reNumber.test(match);
93
98
  if (valid)
94
99
  return match;
95
100
  else
package/lib/util/util.ts CHANGED
@@ -327,7 +327,7 @@ export function deepEqual(o1: any, o2: any, options?: EqOptions): boolean
327
327
  {
328
328
  if (options && options.omitKey && options.omitKey[p])
329
329
  continue;
330
- if (o2[p] === undefined)
330
+ if (o2[p] === undefined && o1[p] !== undefined)
331
331
  return false;
332
332
  if (! deepEqual(o1[p], o2[p], options))
333
333
  return false;
@@ -337,7 +337,7 @@ export function deepEqual(o1: any, o2: any, options?: EqOptions): boolean
337
337
  {
338
338
  if (options && options.omitKey && options.omitKey[p])
339
339
  continue;
340
- if (o1[p] === undefined)
340
+ if (o1[p] === undefined && o2[p] !== undefined)
341
341
  return false;
342
342
  }
343
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.145",
3
+ "version": "1.0.147",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",