@dra2020/baseclient 1.0.38 → 1.0.39

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.
@@ -41,7 +41,8 @@ export interface EqOptions {
41
41
  [key: string]: boolean;
42
42
  };
43
43
  unorderedArrays?: boolean;
44
- emptyStringIsNull: boolean;
44
+ emptyStringIsNull?: boolean;
45
+ epsilon?: number;
45
46
  }
46
47
  export declare function deepEqual(o1: any, o2: any, options?: EqOptions): boolean;
47
48
  export declare function prettyDate(d: Date): string;
package/lib/util/util.ts CHANGED
@@ -264,12 +264,14 @@ export interface EqOptions
264
264
  {
265
265
  omitKey?: { [key: string]: boolean },
266
266
  unorderedArrays?: boolean,
267
- emptyStringIsNull: boolean,
267
+ emptyStringIsNull?: boolean,
268
+ epsilon?: number,
268
269
  }
269
270
 
270
271
  function exactEqual(o1: any, o2: any, options?: EqOptions): boolean
271
272
  {
272
273
  if (o1 === o2) return true;
274
+ if (options && options.epsilon && typeof o1 === 'number' && typeof o2 === 'number' && Math.abs(o1-o2) < options.epsilon) return true;
273
275
  if (options && options.emptyStringIsNull)
274
276
  if ((o1 == null && o2 == '') || (o2 == null && o1 == ''))
275
277
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",