function
Source: index.ts ↗
attributesFind()
Given list of attributes, returns first-found attribute matching the provided predicate.
export declare function attributesFind(attributes: IAttribute[], idOrFun?: string | AttributePredicate): IAttribute | undefined;
Parameters
Parameter | Type | Description |
|---|---|---|
attributes | 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.