-
Notifications
You must be signed in to change notification settings - Fork 283
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
port: Support object comparison in == #3672
Conversation
Pull Request Test Coverage Report for Build 851669384
💛 - Coveralls |
found = args[0].includes(args[1]); | ||
} else if (args[0] instanceof Map) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it seem like this logic is getting lost in this refactor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The logic of contains
of Map would be handlered in accessProperty
*/ | ||
private static convertToObj(instance: unknown) { | ||
if (FunctionUtils.getPropertyCount(instance) >= 0) { | ||
if (instance instanceof Map) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last suggestion, then I promise I won't code-golf anymore on this PR 😄
const entries = instance instanceof Map ? instance.entries() : Object.entries(instance);
return entries.reduce((acc, [key, value]) => ({...acc, [key]: FunctionUtils.convertToObj(value)}), {});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More suggestions better! Means more can learn.
reduce
could not apply on IterableIterator
directly. So I use Array.from(instance.entries()) to convert it into Array.
The browserBot is always failing. But I could not access the details of the error message. @joshgummersall Could you help to take a look and whether some APIs are unavailable. |
@Danieladu yep I discovered that myself today! I'll land this and try to resolve it tomorrow. |
Fixes #3671
Description
Support object comparison in
==
Specific Changes
contains
==
and!=