Skip to content
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

fix(utils/looseEqual): update looseEqual to handle dates (close #7928) #7929

Closed
wants to merge 1 commit into from
Closed

Conversation

w3cj
Copy link

@w3cj w3cj commented Mar 30, 2018

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

} else {
/* istanbul ignore next */
return false
const isDateA = a instanceof Date
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, why did you added it this way instead of another else if condition?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally defined the variables at the top below the isArrayA, and isArrayB variables, but that was calling instanceof for everything that got passed in and added about 500 milliseconds to the test run. It's my first time perusing the code base. Not sure how much this method is used and if it would have a significant impact on anything else.

Also, I originally called instanceof directly inside the if, but tried to follow the code style of putting them in variables first.

@posva
Copy link
Member

posva commented Mar 31, 2018

I created #7940, this is what I meant by adding an else if. Tell me if I missed a scenario you thought about, I kept the test exactly as you added it
Couldn't add your commit, sorry 🙁

@posva posva closed this Mar 31, 2018
@w3cj
Copy link
Author

w3cj commented Mar 31, 2018

Looks good to me, and no worries about the commit. Glad I could help locate the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants