---
lang: en
title: 'API docs: context.resolveuntil'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.resolveuntil.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [resolveUntil](./context.resolveuntil.md)

## resolveUntil() function

Resolve an iterator of source values into a result until the evaluator returns `true`

**Signature:**

```typescript
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

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

source


</td><td markdown="1">

Iterator&lt;T&gt;


</td><td markdown="1">

The iterator of source values


</td></tr>
<tr><td markdown="1">

resolver


</td><td markdown="1">

(sourceVal: T) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;V \| undefined&gt;


</td><td markdown="1">

The resolve function that maps the source value to a result


</td></tr>
<tr><td markdown="1">

evaluator


</td><td markdown="1">

(sourceVal: T, targetVal: V \| undefined) =&gt; boolean


</td><td markdown="1">

The evaluate function that decides when to stop


</td></tr>
</tbody></table>

**Returns:**

[ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;V \| undefined&gt;


