attributesFind()
Home > @gooddata/sdk-model > attributesFind
attributesFind() function
Given list of attributes, returns first-found attribute matching the provided predicate.
Signature:
export declare function attributesFind(attributes: IAttribute[], idOrFun?: string | AttributePredicate): IAttribute | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
attributes | IAttribute[] | list of attributes to work with, must be specified |
idOrFun | string | AttributePredicate | (Optional) attribute identifier or instance of AttributePredicate; anyAttribute predicate is default |
Returns:
IAttribute | undefined
Remarks
If no predicate is provided, then the function defaults to anyAttribute predicate - meaning first found attribute will be returned.
This function also provides convenience to find attribute by its local identifier - if you pass predicate as string the function will automatically create idMatchAttribute predicate.