File tree Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import { DocumentKey } from './document_key';
32
32
import { ObjectValue , ObjectValueBuilder } from './field_value' ;
33
33
import { FieldPath } from './path' ;
34
34
import { TransformOperation } from './transform_operation' ;
35
- import { arrayEquals , equals } from '../util/misc' ;
35
+ import { arrayEquals } from '../util/misc' ;
36
36
37
37
/**
38
38
* Provides a set of fields that can be used to partially patch a document.
@@ -180,7 +180,10 @@ export class Precondition {
180
180
181
181
isEqual ( other : Precondition ) : boolean {
182
182
return (
183
- equals ( this . updateTime , other . updateTime ) && this . exists === other . exists
183
+ this . exists === other . exists &&
184
+ ( this . updateTime
185
+ ? ! ! other . updateTime && this . updateTime ?. isEqual ( other . updateTime )
186
+ : ! other . updateTime )
184
187
) ;
185
188
}
186
189
}
Original file line number Diff line number Diff line change @@ -56,25 +56,10 @@ export function primitiveComparator<T>(left: T, right: T): number {
56
56
return 0 ;
57
57
}
58
58
59
- /** Duck-typed interface for objects that have an isEqual() method. */
60
59
export interface Equatable < T > {
61
60
isEqual ( other : T ) : boolean ;
62
61
}
63
62
64
- /** Helper to compare nullable (or undefined-able) objects using isEqual(). */
65
- export function equals < T > (
66
- left : Equatable < T > | null | undefined ,
67
- right : T | null | undefined
68
- ) : boolean {
69
- if ( left !== null && left !== undefined ) {
70
- return ! ! ( right && left . isEqual ( right ) ) ;
71
- } else {
72
- // HACK: Explicitly cast since TypeScript's type narrowing apparently isn't
73
- // smart enough.
74
- return ( left as null | undefined ) === right ;
75
- }
76
- }
77
-
78
63
/** Helper to compare arrays using isEqual(). */
79
64
export function arrayEquals < T > (
80
65
left : T [ ] ,
You can’t perform that action at this time.
0 commit comments