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 1515 * limitations under the License.
1616 */
1717
18- import { isNumber } from 'util' ;
19-
2018import {
2119 Pipeline as ProtoPipeline ,
2220 Stage as ProtoStage
@@ -29,7 +27,7 @@ import {
2927 selectablesToMap ,
3028 vectorToExpr
3129} from '../util/pipeline_util' ;
32- import { isString } from '../util/types' ;
30+ import { isNumber , isString } from '../util/types' ;
3331
3432import { Firestore } from './database' ;
3533import {
@@ -544,10 +542,15 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
544542 offset ( options : OffsetStageOptions ) : Pipeline ;
545543 offset ( offsetOrOptions : number | OffsetStageOptions ) : Pipeline {
546544 // 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+ }
551554
552555 // Create stage object
553556 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 {
3737 return value === 0 && 1 / value === 1 / - 0 ;
3838}
3939
40+ export function isNumber ( value : unknown ) : value is number {
41+ return typeof value === 'number' ;
42+ }
43+
4044/**
4145 * Returns whether a value is an integer and in the safe integer range
4246 * @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 => {
28232823 } ) ;
28242824 } ) ;
28252825
2826- // TODO re-enabled on fix of b/446938511
2827- it . skip ( 'array contains any' , async ( ) => {
2826+ it ( 'array contains any' , async ( ) => {
28282827 const snapshot = await execute (
28292828 firestore
28302829 . pipeline ( )
@@ -3984,6 +3983,7 @@ apiDescribe.only('Pipelines', persistence => {
39843983 describe ( 'stage options' , ( ) => {
39853984 describe ( 'forceIndex' , ( ) => {
39863985 // SKIP: requires pre-existing index
3986+ // eslint-disable-next-line no-restricted-properties
39873987 it . skip ( 'Collection Stage' , async ( ) => {
39883988 const snapshot = await execute (
39893989 firestore . pipeline ( ) . collection ( {
@@ -3995,6 +3995,7 @@ apiDescribe.only('Pipelines', persistence => {
39953995 } ) ;
39963996
39973997 // SKIP: requires pre-existing index
3998+ // eslint-disable-next-line no-restricted-properties
39983999 it . skip ( 'CollectionGroup Stage' , async ( ) => {
39994000 const snapshot = await execute (
40004001 firestore . pipeline ( ) . collectionGroup ( {
You can’t perform that action at this time.
0 commit comments