-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ADD error on bailout * REPLACE fast-deep-equal because of epoberezkin/fast-deep-equal#105 * REPLACE object-path * UPDATE event-reduce
- Loading branch information
Showing
15 changed files
with
455 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
/** | ||
* Copied from the fast-deep-equal package | ||
* because it does not support es modules and causes optimization bailouts. | ||
* TODO use the npm package again when this is merged: | ||
* @link https://github.com/epoberezkin/fast-deep-equal/pull/105 | ||
*/ | ||
export function deepEqual(a: any, b: any): boolean { | ||
if (a === b) return true; | ||
|
||
if (a && b && typeof a == 'object' && typeof b == 'object') { | ||
if (a.constructor !== b.constructor) return false; | ||
|
||
let length; | ||
let i; | ||
if (Array.isArray(a)) { | ||
length = a.length; | ||
if (length !== b.length) return false; | ||
for (i = length; i-- !== 0;) | ||
if (!deepEqual(a[i], b[i])) return false; | ||
return true; | ||
} | ||
|
||
|
||
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; | ||
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); | ||
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); | ||
|
||
const keys = Object.keys(a); | ||
length = keys.length; | ||
if (length !== Object.keys(b).length) return false; | ||
|
||
for (i = length; i-- !== 0;) | ||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; | ||
|
||
for (i = length; i-- !== 0;) { | ||
const key = keys[i]; | ||
if (!deepEqual(a[key], b[key])) return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
// true if both NaN, false otherwise | ||
return a !== a && b !== b; | ||
} |
Oops, something went wrong.