Skip to content

isIterableEqual

isIterableEqual<T>(a, b, comparisonStrategy?): boolean

Defined in: packages/core/src/iterable/is-iterable-equal.ts:26

Checks whether two iterables yield equal elements in the same order, and the same number of them.

Short-circuits on the first difference, and closes whichever iterator has not ended when it does. The comparison is exact: a tolerant predicate is not a valid equality, so pass one only where intransitivity is acceptable.

Time complexity: O(n) worst case, O(1) when both are arrays of differing length.

T

Iterable<T>

The first iterable.

Iterable<T>

The second iterable.

EqualityComparisonStrategy<T, T> = IS_ITERABLE_EQUAL_DEFAULT_COMPARISON_STRATEGY

The equality comparison strategy to use (default is “strict”). Resolved once, not re-dispatched per element.

boolean

true if both iterables yield the same elements in the same order.