-
Notifications
You must be signed in to change notification settings - Fork 153
Adding isEqual to the public API #140
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 1688 1728 +40
=====================================
+ Hits 1688 1728 +40
Continue to review full report at Codecov.
|
6428b23
to
428f8dc
Compare
b5fd2be
to
0b038c9
Compare
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.
LGTM with some optional nits.
src/document.js
Outdated
this === other || | ||
(is.instance(other, DocumentSnapshot) && | ||
this._ref.isEqual(other._ref) && | ||
deepEqual(this._fieldsProto, other._fieldsProto)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.js
Outdated
isEqual(other) { | ||
return ( | ||
this === other || | ||
(is.instanceof(other, Path) && this.compareTo(other) === 0) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -106,6 +106,20 @@ class WriteResult { | |||
get writeTime() { | |||
return this._writeTime; | |||
} | |||
|
|||
/** | |||
* Returns true if this `WriteResult` is equal to the provided value. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
test/collection.js
Outdated
@@ -142,4 +142,12 @@ describe('Collection interface', function() { | |||
assert.ok(documentRef.id.length, 20); | |||
}); | |||
}); | |||
|
|||
it('has equals() method', function() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
f02041d
to
a609421
Compare
This adds isEquals to all out public API types, ignoring metadata for all *Snapshots.
The API is mostly a port from Web, with the addition of an isEqulas for WriteResult and DocumentChange.
There are also some changes to QueryDocumentSnapshot to make equals more efficient when not all changes are materialized yet.