Skip to content

Add isEqual() and port DocumentReference array test. #222

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

Merged
merged 1 commit into from
Oct 16, 2017

Conversation

mikelehen
Copy link
Contributor

This is a port of the tests for the fix I made for Android (and implementing isEqual). Note that the isEqual() API was previously discussed (when it was added for RTDB). See internal issue b/62143881 for more details.

* @param other The `DocumentReference` to compare against.
* @return true if this `DocumentReference` is equal to the provided one.
*/
isEqual(other: DocumentReference): boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is gas on a fire, but why isEqual? Within our codebase I see usages like these:
equals 187
isEqual 53

Looking more closely, the 53 usages of isEqual are just database's Query.isEqual and its tests (some some checked in logs and Firestore's Query.isEqual).

It seems far more conventional to call this method equals.

(BTW: I'm finding usages like this)

find . \( -name node_modules \
    -o -name dist \
    -o -name \*.js \
    -o -name \*.map \) -prune -o -type f -print0 \
  | xargs -0 grep isEqual

Copy link
Contributor

@wilhuff wilhuff Oct 16, 2017

Choose a reason for hiding this comment

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

Okay, discussed offline, and it's clear that there's no consensus in the world about isEqual vs equals. The much larger incidence of equals within our code are internal APIs.

Let's file a clean up bug to standardize on isEqual so that customDeepEqual need not check both.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

* @param other The `DocumentReference` to compare against.
* @return true if this `DocumentReference` is equal to the provided one.
*/
isEqual(other: DocumentReference): boolean;
Copy link
Contributor

@wilhuff wilhuff Oct 16, 2017

Choose a reason for hiding this comment

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

Okay, discussed offline, and it's clear that there's no consensus in the world about isEqual vs equals. The much larger incidence of equals within our code are internal APIs.

Let's file a clean up bug to standardize on isEqual so that customDeepEqual need not check both.

@mikelehen
Copy link
Contributor Author

Josh, can you approve for the .d.ts change in the firebase package?

Copy link
Contributor

@jshcrowthe jshcrowthe left a comment

Choose a reason for hiding this comment

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

Looks good.

@mikelehen mikelehen merged commit 4b55572 into master Oct 16, 2017
@mikelehen mikelehen deleted the mikelehen-isEqual-and-array-test branch October 16, 2017 23:07
@firebase firebase locked and limited conversation to collaborators Oct 25, 2019
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.

4 participants