@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.
- package/dist/baseclient.js +2 -0
- package/dist/baseclient.js.map +1 -1
- package/dist/util/util.d.ts +2 -1
- package/lib/util/util.ts +3 -1
- package/package.json +1 -1
package/dist/util/util.d.ts
CHANGED
|
@@ -41,7 +41,8 @@ export interface EqOptions {
|
|
|
41
41
|
[key: string]: boolean;
|
|
42
42
|
};
|
|
43
43
|
unorderedArrays?: boolean;
|
|
44
|
-
emptyStringIsNull
|
|
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
|
|
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;
|