( ...unfilteredConditions: (SQLWrapper | undefined)[] )
| 142 | */ |
| 143 | export function or(...conditions: (SQLWrapper | undefined)[]): SQL | undefined; |
| 144 | export function or( |
| 145 | ...unfilteredConditions: (SQLWrapper | undefined)[] |
| 146 | ): SQL | undefined { |
| 147 | const conditions = unfilteredConditions.filter( |
| 148 | (c): c is Exclude<typeof c, undefined> => c !== undefined, |
| 149 | ); |
| 150 | |
| 151 | if (conditions.length === 0) { |
| 152 | return undefined; |
| 153 | } |
| 154 | |
| 155 | if (conditions.length === 1) { |
| 156 | return new SQL(conditions); |
| 157 | } |
| 158 | |
| 159 | return new SQL([ |
| 160 | new StringChunk('('), |
| 161 | sql.join(conditions, new StringChunk(' or ')), |
| 162 | new StringChunk(')'), |
| 163 | ]); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Negate the meaning of an expression using the `not` keyword. |
no outgoing calls
no test coverage detected