File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- import { isNumber } from 'util' ;
19
-
20
18
import {
21
19
Pipeline as ProtoPipeline ,
22
20
Stage as ProtoStage
@@ -29,7 +27,7 @@ import {
29
27
selectablesToMap ,
30
28
vectorToExpr
31
29
} from '../util/pipeline_util' ;
32
- import { isString } from '../util/types' ;
30
+ import { isNumber , isString } from '../util/types' ;
33
31
34
32
import { Firestore } from './database' ;
35
33
import {
@@ -544,10 +542,15 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
544
542
offset ( options : OffsetStageOptions ) : Pipeline ;
545
543
offset ( offsetOrOptions : number | OffsetStageOptions ) : Pipeline {
546
544
// Process argument union(s) from method overloads
547
- const options = isNumber ( offsetOrOptions ) ? { } : offsetOrOptions ;
548
- const offset : number = isNumber ( offsetOrOptions )
549
- ? offsetOrOptions
550
- : offsetOrOptions . offset ;
545
+ let options : { } ;
546
+ let offset : number ;
547
+ if ( isNumber ( offsetOrOptions ) ) {
548
+ options = { } ;
549
+ offset = offsetOrOptions ;
550
+ } else {
551
+ options = offsetOrOptions ;
552
+ offset = offsetOrOptions . offset ;
553
+ }
551
554
552
555
// Create stage object
553
556
const stage = new Offset ( offset , options ) ;
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ export function isNegativeZero(value: number): boolean {
37
37
return value === 0 && 1 / value === 1 / - 0 ;
38
38
}
39
39
40
+ export function isNumber ( value : unknown ) : value is number {
41
+ return typeof value === 'number' ;
42
+ }
43
+
40
44
/**
41
45
* Returns whether a value is an integer and in the safe integer range
42
46
* @param value - The value to test for being an integer and in the safe range
Original file line number Diff line number Diff line change @@ -2823,8 +2823,7 @@ apiDescribe.only('Pipelines', persistence => {
2823
2823
} ) ;
2824
2824
} ) ;
2825
2825
2826
- // TODO re-enabled on fix of b/446938511
2827
- it . skip ( 'array contains any' , async ( ) => {
2826
+ it ( 'array contains any' , async ( ) => {
2828
2827
const snapshot = await execute (
2829
2828
firestore
2830
2829
. pipeline ( )
@@ -3984,6 +3983,7 @@ apiDescribe.only('Pipelines', persistence => {
3984
3983
describe ( 'stage options' , ( ) => {
3985
3984
describe ( 'forceIndex' , ( ) => {
3986
3985
// SKIP: requires pre-existing index
3986
+ // eslint-disable-next-line no-restricted-properties
3987
3987
it . skip ( 'Collection Stage' , async ( ) => {
3988
3988
const snapshot = await execute (
3989
3989
firestore . pipeline ( ) . collection ( {
@@ -3995,6 +3995,7 @@ apiDescribe.only('Pipelines', persistence => {
3995
3995
} ) ;
3996
3996
3997
3997
// SKIP: requires pre-existing index
3998
+ // eslint-disable-next-line no-restricted-properties
3998
3999
it . skip ( 'CollectionGroup Stage' , async ( ) => {
3999
4000
const snapshot = await execute (
4000
4001
firestore . pipeline ( ) . collectionGroup ( {
You can’t perform that action at this time.
0 commit comments