ifEmpty

Full name: taxi.stdlib.ifEmpty

Signature

declare extension function <T> ifEmpty(source:T[], defaultValue:T[]): T[]

Description

Returns the source array if it is non-empty, otherwise returns the provided default array.

find { order: Order } as {
   tags: order.tags.ifEmpty(['untagged'])
}

Examples

Returns the default array when the source is empty, or the source array when it has elements.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi