Page Contents

Home > @loopback/context > resolveUntil

resolveUntil() function

Resolve an iterator of source values into a result until the evaluator returns true

Signature:

export declare function resolveUntil<T, V>(source: Iterator<T>, resolver: (sourceVal: T) => ValueOrPromise<V | undefined>, evaluator: (sourceVal: T, targetVal: V | undefined) => boolean): ValueOrPromise<V | undefined>;

Parameters

Parameter Type Description
source Iterator<T> The iterator of source values
resolver (sourceVal: T) => ValueOrPromise<V | undefined> The resolve function that maps the source value to a result
evaluator (sourceVal: T, targetVal: V | undefined) => boolean The evaluate function that decides when to stop

Returns:

ValueOrPromise<V | undefined>