bucketAttributeIndex()
Home > @gooddata/sdk-model > bucketAttributeIndex
bucketAttributeIndex() function
Gets the index of the first attribute matching the provided predicate from the bucket.
Signature:
export declare function bucketAttributeIndex(bucket: IBucket, idOrFun?: string | AttributePredicate): number;
Parameters
Parameter | Type | Description |
---|---|---|
bucket | IBucket | bucket to to search in |
idOrFun | string | AttributePredicate | (Optional) attribute identifier or instance of AttributePredicate; anyAttribute predicate is default |
Returns:
number
-1 if no matching attribute is found
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.