(
attr: DataModelAttribute | DataFieldAttribute | InternalAttribute,
name: string,
)
| 398 | * Gets the literal value of the argument with the given name from the given attribute. Returns `undefined` if no such argument is found or if the argument value cannot be determined or is not a literal. |
| 399 | */ |
| 400 | export function getAttributeArgLiteral<T extends string | number | boolean>( |
| 401 | attr: DataModelAttribute | DataFieldAttribute | InternalAttribute, |
| 402 | name: string, |
| 403 | ): T | undefined { |
| 404 | for (const arg of attr.args) { |
| 405 | if (arg.$resolvedParam?.name === name) { |
| 406 | return getLiteral<T>(arg.value); |
| 407 | } |
| 408 | } |
| 409 | return undefined; |
| 410 | } |
| 411 | |
| 412 | /** |
| 413 | * Gets the allowed expression contexts for the given function declaration by looking for `@@expressionContext` attribute. |
no test coverage detected