MCPcopy Index your code
hub / github.com/zenstackhq/zenstack / getAttributeArg

Function getAttributeArg

packages/language/src/utils.ts:390–395  ·  view source on GitHub ↗
(
    attr: DataModelAttribute | DataFieldAttribute | InternalAttribute,
    name: string,
)

Source from the content-addressed store, hash-verified

388 * Gets the 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.
389 */
390export function getAttributeArg(
391 attr: DataModelAttribute | DataFieldAttribute | InternalAttribute,
392 name: string,
393): Expression | undefined {
394 return attr.args.find((arg) => arg.$resolvedParam?.name === name)?.value;
395}
396
397/**
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.

Callers 3

_checkConstraintMethod · 0.90

Calls 1

findMethod · 0.80

Tested by

no test coverage detected