(value: any)
| 216 | * Prefer this over ad-hoc local implementations to keep behavior consistent. |
| 217 | */ |
| 218 | export function isExpressionLike(value: any): boolean { |
| 219 | if ( |
| 220 | value instanceof Aggregate || |
| 221 | value instanceof ConditionalSelect || |
| 222 | value instanceof Func || |
| 223 | value instanceof PropRef || |
| 224 | value instanceof Value || |
| 225 | value instanceof IncludesSubquery |
| 226 | ) { |
| 227 | return true |
| 228 | } |
| 229 | |
| 230 | if (!value || typeof value !== `object`) { |
| 231 | return false |
| 232 | } |
| 233 | |
| 234 | if (value.type === `conditionalSelect`) { |
| 235 | return Array.isArray(value.branches) |
| 236 | } |
| 237 | |
| 238 | if (value.type === `agg` || value.type === `func`) { |
| 239 | return typeof value.name === `string` && Array.isArray(value.args) |
| 240 | } |
| 241 | |
| 242 | if (value.type === `ref`) { |
| 243 | return Array.isArray(value.path) |
| 244 | } |
| 245 | |
| 246 | if (value.type === `val`) { |
| 247 | return `value` in value |
| 248 | } |
| 249 | |
| 250 | if (value.type === `includesSubquery`) { |
| 251 | return `query` in value && `fieldName` in value |
| 252 | } |
| 253 | |
| 254 | return false |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Helper functions for working with Where clauses |
no outgoing calls
no test coverage detected
searching dependent graphs…