Skip to content

trimEndWhileAsync

trimEndWhileAsync<T>(iterable, predicate): AsyncIterableIterator<T>

Defined in: packages/core/src/iterable/async/trim-while.ts:18

Yields the elements with any trailing run satisfying predicate removed.

The async counterpart of trimEndWhile. An element is only known to be trailing once something that fails predicate follows it, so a run of candidates is held back until then.

Time complexity: O(n). Memory: O(longest matching run).

T

MaybeAsyncIterable<T>

The input iterable, sync or async.

MaybeAsyncPredicate<[T]>

Decides whether an element may be trimmed.

AsyncIterableIterator<T>

An iterator over the elements, trailing matches removed.