Skip to content

Commit 0f01cc0

Browse files
committed
update js docs
1 parent 9b81e09 commit 0f01cc0

2 files changed

Lines changed: 40 additions & 35 deletions

File tree

handwritten/firestore/dev/src/pipelines/expression.ts

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9258,73 +9258,73 @@ export function ifAbsent(
92589258

92599259
/**
92609260
* @beta
9261-
* Creates an expression that returns the `elseExpr` argument if `ifExpr` is null, else
9261+
* Creates an expression that returns the `elseExpr` argument if `ifExpr` is null or absent, else
92629262
* return the result of the `ifExpr` argument evaluation.
92639263
*
92649264
* @example
92659265
* ```typescript
92669266
* // Returns the value of the 'optional_field', or returns value of the 'default_field'
9267-
* // if the 'optional_field' value is null.
9267+
* // if the 'optional_field' value is null or absent.
92689268
* ifNull(field("optional_field"), field("default_field"))
92699269
* ```
92709270
*
9271-
* @param ifExpr The expression to check for null.
9272-
* @param elseExpr The value that will be returned if `ifExpr` evaluates to a null value.
9271+
* @param ifExpr The expression to check for null or absence.
9272+
* @param elseExpr The expression that will be evaluated and returned if `ifExpr` is null or absent.
92739273
* @returns A new `Expression` representing the ifNull operation.
92749274
*/
92759275
export function ifNull(ifExpr: Expression, elseExpr: Expression): Expression;
92769276

92779277
/**
92789278
* @beta
9279-
* Creates an expression that returns the `elseValue` argument if `ifExpr` is null, else
9279+
* Creates an expression that returns the `elseValue` argument if `ifExpr` is null or absent, else
92809280
* return the result of the `ifExpr` argument evaluation.
92819281
*
92829282
* @example
92839283
* ```typescript
92849284
* // Returns the value of the 'optional_field', or returns 'default_value'
9285-
* // if the 'optional_field' value is null.
9285+
* // if the 'optional_field' value is null or absent.
92869286
* ifNull(field("optional_field"), "default_value")
92879287
* ```
92889288
*
9289-
* @param ifExpr The expression to check for null.
9290-
* @param elseValue The value that will be returned if `ifExpr` evaluates to a null value.
9289+
* @param ifExpr The expression to check for absence.
9290+
* @param elseValue The value that will be returned if `ifExpr` evaluates to a null or absent value.
92919291
* @returns A new `Expression` representing the ifNull operation.
92929292
*/
92939293
export function ifNull(ifExpr: Expression, elseValue: unknown): Expression;
92949294

92959295
/**
92969296
* @beta
9297-
* Creates an expression that returns the `elseExpr` argument if `ifFieldName` is null, else
9297+
* Creates an expression that returns the `elseExpr` argument if `ifFieldName` is null or absent, else
92989298
* return the value of the field.
92999299
*
93009300
* @example
93019301
* ```typescript
93029302
* // Returns the value of the 'optional_field', or returns the value of
9303-
* // 'default_field' if 'optional_field' is null.
9303+
* // 'default_field' if 'optional_field' is null or absent.
93049304
* ifNull("optional_field", field("default_field"))
93059305
* ```
93069306
*
9307-
* @param ifFieldName The field to check for null.
9307+
* @param ifFieldName The field to check for null or absence.
93089308
* @param elseExpr The expression that will be evaluated and returned if `ifFieldName` is
9309-
* null.
9309+
* null or absent.
93109310
* @returns A new `Expression` representing the ifNull operation.
93119311
*/
93129312
export function ifNull(ifFieldName: string, elseExpr: Expression): Expression;
93139313

93149314
/**
93159315
* @beta
9316-
* Creates an expression that returns the `elseValue` argument if `ifFieldName` is null, else
9316+
* Creates an expression that returns the `elseValue` argument if `ifFieldName` is null or absent, else
93179317
* return the value of the field.
93189318
*
93199319
* @example
93209320
* ```typescript
93219321
* // Returns the value of the 'optional_field', or returns 'default_value'
9322-
* // if the field is null.
9322+
* // if the field is null or absent.
93239323
* ifNull("optional_field", "default_value")
93249324
* ```
93259325
*
9326-
* @param ifFieldName The field to check for null.
9327-
* @param elseValue The value that will be returned if `ifFieldName` is null.
9326+
* @param ifFieldName The field to check for null or absence.
9327+
* @param elseValue The value that will be returned if `ifFieldName` is null or absent.
93289328
* @returns A new `Expression` representing the ifNull operation.
93299329
*/
93309330
export function ifNull(ifFieldName: string, elseValue: unknown): Expression;
@@ -9339,29 +9339,31 @@ export function ifNull(
93399339

93409340
/**
93419341
* @beta
9342-
* Returns the first non-null value among the given expressions/values.
9342+
* Returns the first non-null, non-absent argument, without evaluating
9343+
* the rest of the arguments. When all arguments are null or absent, returns the last argument.
93439344
*
93449345
* @example
93459346
* ```typescript
93469347
* // Returns the value of 'optional_field', or if that is
93479348
* // null, then returns the value of 'default_field'
9348-
* coalesce("optional_field", field("default_field"))
9349+
* coalesce(field("optional_field"), field("default_field"))
93499350
* ```
93509351
*
9351-
* @param first The first expression to evaluate.
9352-
* @param second The next expression or literal to evaluate.
9353-
* @param others Additional expressions or literals to evaluate.
9352+
* @param expression The first expression to check for null.
9353+
* @param replacement The fallback expression or value if the first one is null.
9354+
* @param others Optional additional expressions to check if previous ones are null.
93549355
* @returns A new `Expression` representing the coalesce operation.
93559356
*/
93569357
export function coalesce(
9357-
first: Expression,
9358-
second: Expression | unknown,
9358+
expression: Expression,
9359+
replacement: Expression | unknown,
93599360
...others: Array<Expression | unknown>
93609361
): Expression;
93619362

93629363
/**
93639364
* @beta
9364-
* Returns the first non-null value among the given expressions/values.
9365+
* Returns the first non-null, non-absent argument, without evaluating
9366+
* the rest of the arguments. When all arguments are null or absent, returns the last argument.
93659367
*
93669368
* @example
93679369
* ```typescript
@@ -9370,14 +9372,14 @@ export function coalesce(
93709372
* coalesce("optional_field", field("default_field"))
93719373
* ```
93729374
*
9373-
* @param firstFieldName The first field name to evaluate.
9374-
* @param second The next expression or literal to evaluate.
9375-
* @param others Additional expressions or literals to evaluate.
9375+
* @param fieldName The name of the first field to check for null.
9376+
* @param replacement The fallback expression or value if the first one is null.
9377+
* @param others Optional additional expressions to check if previous ones are null.
93769378
* @returns A new `Expression` representing the coalesce operation.
93779379
*/
93789380
export function coalesce(
9379-
firstFieldName: string,
9380-
second: Expression | unknown,
9381+
fieldName: string,
9382+
replacement: Expression | unknown,
93819383
...others: Array<Expression | unknown>
93829384
): Expression;
93839385

handwritten/firestore/types/firestore.d.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10954,7 +10954,7 @@ declare namespace FirebaseFirestore {
1095410954
*
1095510955
* @param ifExpr The expression to check for null.
1095610956
* @param elseExpr The value that will be returned if `ifExpr` evaluates to a null value.
10957-
* @returns A new {@code Expression} representing the ifNull operation.
10957+
* @returns A new [Expression] representing the ifNull operation.
1095810958
*/
1095910959
export function ifNull(
1096010960
ifExpr: Expression,
@@ -10975,7 +10975,7 @@ declare namespace FirebaseFirestore {
1097510975
*
1097610976
* @param ifExpr The expression to check for null.
1097710977
* @param elseValue The value that will be returned if `ifExpr` evaluates to a null value.
10978-
* @returns A new {@code Expression} representing the ifNull operation.
10978+
* @returns A new [Expression] representing the ifNull operation.
1097910979
*/
1098010980
export function ifNull(ifExpr: Expression, elseValue: unknown): Expression;
1098110981

@@ -10994,7 +10994,7 @@ declare namespace FirebaseFirestore {
1099410994
* @param ifFieldName The field to check for null.
1099510995
* @param elseExpr The expression that will be evaluated and returned if `ifFieldName` is
1099610996
* null.
10997-
* @returns A new {@code Expression} representing the ifNull operation.
10997+
* @returns A new Expression representing the ifNull operation.
1099810998
*/
1099910999
export function ifNull(
1100011000
ifFieldName: string,
@@ -11015,9 +11015,12 @@ declare namespace FirebaseFirestore {
1101511015
*
1101611016
* @param ifFieldName The field to check for null.
1101711017
* @param elseValue The value that will be returned if `ifFieldName` is null.
11018-
* @returns A new {@code Expression} representing the ifNull operation.
11018+
* @returns A new Expression representing the ifNull operation.
1101911019
*/
11020-
export function ifNull(ifFieldName: string, elseValue: unknown): Expression;
11020+
export function ifNull(
11021+
ifFieldName: string | Expression,
11022+
elseValue: Expression | unknown,
11023+
): Expression;
1102111024

1102211025
/**
1102311026
* @beta
@@ -11033,7 +11036,7 @@ declare namespace FirebaseFirestore {
1103311036
* @param first The first expression to evaluate.
1103411037
* @param second The next expression or literal to evaluate.
1103511038
* @param others Additional expressions or literals to evaluate.
11036-
* @returns A new {@code Expression} representing the coalesce operation.
11039+
* @returns A new [Expression] representing the coalesce operation.
1103711040
*/
1103811041
export function coalesce(
1103911042
first: Expression,

0 commit comments

Comments
 (0)