-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Iterable equality within object #8359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9bc6a08
86312c9
7e13ba4
8ec8ab5
53408bd
87c4e62
1e5d3b7
84f8bda
8068054
3cd2b4e
c4d40b9
2c3a862
416f5b3
e50e95e
5a46db1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,6 +133,9 @@ export const getObjectSubset = (object: any, subset: any): any => { | |
| return object; | ||
| }; | ||
|
|
||
| export const getObjectEntries = (object: any): Array<any> => | ||
| object == null ? [] : Object.keys(object).map((key) => [key, object[key]]) | ||
|
|
||
| const IteratorSymbol = Symbol.iterator; | ||
|
|
||
| const hasIterator = (object: any) => | ||
|
|
@@ -251,8 +254,8 @@ export const iterableEquality = ( | |
| return false; | ||
| } | ||
|
|
||
| const aEntries = Object.entries(a); | ||
| const bEntries = Object.entries(b); | ||
| const aEntries = getObjectEntries(a); | ||
| const bEntries = getObjectEntries(b); | ||
| if (!equals(aEntries, bEntries)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add This illustrates a limitation that we recently noticed: it is not (yet) possible to for a custom tester to know about sibling testers (for example,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pedrottimark is there an extra test case you're thinking of we should add?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm so sorry for the very late follow up.
IMO |
||
| return false; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.