X Tutup
Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor: Refactor the equals function for readability#13650

Closed
TehShrike wants to merge 1 commit intoangular:masterfrom
TehShrike:cleaning-up-equals-function
Closed

refactor: Refactor the equals function for readability#13650
TehShrike wants to merge 1 commit intoangular:masterfrom
TehShrike:cleaning-up-equals-function

Conversation

@TehShrike
Copy link
Copy Markdown
Contributor

  • Turn an unnecessary nested if block into an &&
  • Change the isRegExp block to use the same "if the second argument is the wrong type, return false" pattern as all the other blocks

- Turn an unnecessary nested if block into an &&
- Change the isRegExp block to use the same "if the second argument is the wrong type, return
false" pattern as all the other blocks
@gkalpak
Copy link
Copy Markdown
Member

gkalpak commented Jan 21, 2016

LGTM (does exactly as the description says - git diffing adds much more noise 😃)

@TehShrike
Copy link
Copy Markdown
Contributor Author

It's true, the no-whitespace diff is a lot shorter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[nit] I find return isRegExp(o2) && o1.toString() == o2.toString(); easier to read, but not a blocker

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Me too, but every other if (some type) block used the other pattern, and the function as a whole seemed easier to read when they all followed the same pattern.

@lgalfaso lgalfaso closed this in a277bcf Jan 22, 2016
@TehShrike TehShrike deleted the cleaning-up-equals-function branch January 22, 2016 20:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup