trimWhile
trimWhile<
T>(iterable,predicate):IterableIterator<T>
Defined in: packages/core/src/iterable/trim-while.ts:49
Yields the elements with any leading and trailing run satisfying
predicate removed.
The generic form of String.prototype.trim. The start-only case is
dropWhile, which this composes rather than duplicating.
Time complexity: O(n). Memory: O(longest matching run), as trimEndWhile.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
predicate
Section titled “predicate”Predicate<[T]>
Decides whether an element may be trimmed.
Returns
Section titled “Returns”IterableIterator<T>
An iterator over the elements, leading and trailing matches removed.