@@ -157,9 +157,9 @@ export class Transaction implements legacy.Transaction {
157
157
options ?: legacy . SetOptions
158
158
) : Transaction {
159
159
if ( options ) {
160
- this . _delegate . set ( documentRef . _delegate , unwwrap ( data ) , options ) ;
160
+ this . _delegate . set ( documentRef . _delegate , unwrap ( data ) , options ) ;
161
161
} else {
162
- this . _delegate . set ( documentRef . _delegate , unwwrap ( data ) ) ;
162
+ this . _delegate . set ( documentRef . _delegate , unwrap ( data ) ) ;
163
163
}
164
164
return this ;
165
165
}
@@ -181,13 +181,13 @@ export class Transaction implements legacy.Transaction {
181
181
...moreFieldsAndValues : any [ ]
182
182
) : Transaction {
183
183
if ( arguments . length === 2 ) {
184
- this . _delegate . update ( documentRef . _delegate , unwwrap ( dataOrField ) ) ;
184
+ this . _delegate . update ( documentRef . _delegate , unwrap ( dataOrField ) ) ;
185
185
} else {
186
186
this . _delegate . update (
187
187
documentRef . _delegate ,
188
- unwwrap ( dataOrField ) ,
189
- value ,
190
- ...unwwrap ( moreFieldsAndValues )
188
+ unwrap ( dataOrField ) ,
189
+ unwrap ( value ) ,
190
+ ...unwrap ( moreFieldsAndValues )
191
191
) ;
192
192
}
193
193
@@ -209,9 +209,9 @@ export class WriteBatch implements legacy.WriteBatch {
209
209
options ?: legacy . SetOptions
210
210
) : WriteBatch {
211
211
if ( options ) {
212
- this . _delegate . set ( documentRef . _delegate , unwwrap ( data ) , options ) ;
212
+ this . _delegate . set ( documentRef . _delegate , unwrap ( data ) , options ) ;
213
213
} else {
214
- this . _delegate . set ( documentRef . _delegate , unwwrap ( data ) ) ;
214
+ this . _delegate . set ( documentRef . _delegate , unwrap ( data ) ) ;
215
215
}
216
216
return this ;
217
217
}
@@ -233,13 +233,13 @@ export class WriteBatch implements legacy.WriteBatch {
233
233
...moreFieldsAndValues : any [ ]
234
234
) : WriteBatch {
235
235
if ( arguments . length === 2 ) {
236
- this . _delegate . update ( documentRef . _delegate , unwwrap ( dataOrField ) ) ;
236
+ this . _delegate . update ( documentRef . _delegate , unwrap ( dataOrField ) ) ;
237
237
} else {
238
238
this . _delegate . update (
239
239
documentRef . _delegate ,
240
- unwwrap ( dataOrField ) ,
241
- value ,
242
- ...unwwrap ( moreFieldsAndValues )
240
+ unwrap ( dataOrField ) ,
241
+ unwrap ( value ) ,
242
+ ...unwrap ( moreFieldsAndValues )
243
243
) ;
244
244
}
245
245
@@ -280,9 +280,9 @@ export class DocumentReference<T = legacy.DocumentData>
280
280
281
281
set ( data : Partial < T > , options ?: legacy . SetOptions ) : Promise < void > {
282
282
if ( options ) {
283
- return setDoc ( this . _delegate , unwwrap ( data ) , options ) ;
283
+ return setDoc ( this . _delegate , unwrap ( data ) , options ) ;
284
284
} else {
285
- return setDoc ( this . _delegate , unwwrap ( data ) ) ;
285
+ return setDoc ( this . _delegate , unwrap ( data ) ) ;
286
286
}
287
287
}
288
288
@@ -298,13 +298,13 @@ export class DocumentReference<T = legacy.DocumentData>
298
298
...moreFieldsAndValues : any [ ]
299
299
) : Promise < void > {
300
300
if ( arguments . length === 1 ) {
301
- return updateDoc ( this . _delegate , unwwrap ( dataOrField ) ) ;
301
+ return updateDoc ( this . _delegate , unwrap ( dataOrField ) ) ;
302
302
} else {
303
303
return updateDoc (
304
304
this . _delegate ,
305
- unwwrap ( dataOrField ) ,
306
- value ,
307
- ...unwwrap ( moreFieldsAndValues )
305
+ unwrap ( dataOrField ) ,
306
+ unwrap ( value ) ,
307
+ ...unwrap ( moreFieldsAndValues )
308
308
) ;
309
309
}
310
310
}
@@ -414,7 +414,7 @@ export class DocumentSnapshot<T = legacy.DocumentData>
414
414
}
415
415
416
416
get ( fieldPath : string | FieldPath , options ?: legacy . SnapshotOptions ) : any {
417
- return wrap ( this . _delegate . get ( unwwrap ( fieldPath ) , options ) ) ;
417
+ return wrap ( this . _delegate . get ( unwrap ( fieldPath ) , options ) ) ;
418
418
}
419
419
420
420
isEqual ( other : DocumentSnapshot < T > ) : boolean {
@@ -445,7 +445,7 @@ export class Query<T = legacy.DocumentData> implements legacy.Query<T> {
445
445
value : any
446
446
) : Query < T > {
447
447
return new Query < T > (
448
- this . _delegate . where ( unwwrap ( fieldPath ) , opStr , unwwrap ( value ) )
448
+ this . _delegate . where ( unwrap ( fieldPath ) , opStr , unwrap ( value ) )
449
449
) ;
450
450
}
451
451
@@ -454,7 +454,7 @@ export class Query<T = legacy.DocumentData> implements legacy.Query<T> {
454
454
directionStr ?: legacy . OrderByDirection
455
455
) : Query < T > {
456
456
return new Query < T > (
457
- this . _delegate . orderBy ( unwwrap ( fieldPath ) , directionStr )
457
+ this . _delegate . orderBy ( unwrap ( fieldPath ) , directionStr )
458
458
) ;
459
459
}
460
460
@@ -470,31 +470,31 @@ export class Query<T = legacy.DocumentData> implements legacy.Query<T> {
470
470
if ( args [ 0 ] instanceof DocumentSnapshot ) {
471
471
return new Query ( this . _delegate . startAt ( args [ 0 ] . _delegate ) ) ;
472
472
} else {
473
- return new Query ( this . _delegate . startAt ( ...unwwrap ( args ) ) ) ;
473
+ return new Query ( this . _delegate . startAt ( ...unwrap ( args ) ) ) ;
474
474
}
475
475
}
476
476
477
477
startAfter ( ...args : any [ ] ) : Query < T > {
478
478
if ( args [ 0 ] instanceof DocumentSnapshot ) {
479
479
return new Query ( this . _delegate . startAfter ( args [ 0 ] . _delegate ) ) ;
480
480
} else {
481
- return new Query ( this . _delegate . startAfter ( ...unwwrap ( args ) ) ) ;
481
+ return new Query ( this . _delegate . startAfter ( ...unwrap ( args ) ) ) ;
482
482
}
483
483
}
484
484
485
485
endBefore ( ...args : any [ ] ) : Query < T > {
486
486
if ( args [ 0 ] instanceof DocumentSnapshot ) {
487
487
return new Query ( this . _delegate . endBefore ( args [ 0 ] . _delegate ) ) ;
488
488
} else {
489
- return new Query ( this . _delegate . endBefore ( ...unwwrap ( args ) ) ) ;
489
+ return new Query ( this . _delegate . endBefore ( ...unwrap ( args ) ) ) ;
490
490
}
491
491
}
492
492
493
493
endAt ( ...args : any [ ] ) : Query < T > {
494
494
if ( args [ 0 ] instanceof DocumentSnapshot ) {
495
495
return new Query ( this . _delegate . endAt ( args [ 0 ] . _delegate ) ) ;
496
496
} else {
497
- return new Query ( this . _delegate . endAt ( ...unwwrap ( args ) ) ) ;
497
+ return new Query ( this . _delegate . endAt ( ...unwrap ( args ) ) ) ;
498
498
}
499
499
}
500
500
@@ -649,7 +649,7 @@ export class CollectionReference<T = legacy.DocumentData> extends Query<T>
649
649
}
650
650
651
651
add ( data : T ) : Promise < DocumentReference < T > > {
652
- return addDoc ( this . _delegate , unwwrap ( data ) ) . then (
652
+ return addDoc ( this . _delegate , unwrap ( data ) ) . then (
653
653
docRef => new DocumentReference ( docRef )
654
654
) ;
655
655
}
@@ -681,11 +681,11 @@ export class FieldValue implements legacy.FieldValue {
681
681
}
682
682
683
683
static arrayUnion ( ...elements : any [ ] ) : FieldValue {
684
- return new FieldValue ( arrayUnion ( ...elements ) ) ;
684
+ return new FieldValue ( arrayUnion ( ...unwrap ( elements ) ) ) ;
685
685
}
686
686
687
687
static arrayRemove ( ...elements : any [ ] ) : FieldValue {
688
- return new FieldValue ( arrayRemove ( ...elements ) ) ;
688
+ return new FieldValue ( arrayRemove ( ...unwrap ( elements ) ) ) ;
689
689
}
690
690
691
691
static increment ( n : number ) : FieldValue {
@@ -745,11 +745,11 @@ function wrap(value: any): any {
745
745
* Takes user data that uses API types from this shim and replaces them
746
746
* with the the firestore-exp API types.
747
747
*/
748
- function unwwrap ( value : any ) : any {
748
+ function unwrap ( value : any ) : any {
749
749
if ( Array . isArray ( value ) ) {
750
- return value . map ( v => unwwrap ( v ) ) ;
750
+ return value . map ( v => unwrap ( v ) ) ;
751
751
} else if ( value instanceof FieldPath ) {
752
- return value . _delegate ;
752
+ return value . _delegate ;
753
753
} else if ( value instanceof FieldValue ) {
754
754
return value . _delegate ;
755
755
} else if ( value instanceof DocumentReference ) {
@@ -758,7 +758,7 @@ function unwwrap(value: any): any {
758
758
const obj : any = { } ;
759
759
for ( const key in value ) {
760
760
if ( value . hasOwnProperty ( key ) ) {
761
- obj [ key ] = unwwrap ( value [ key ] ) ;
761
+ obj [ key ] = unwrap ( value [ key ] ) ;
762
762
}
763
763
}
764
764
return obj ;
0 commit comments