UNPKG

524 BJavaScriptView Raw
1import { comparerAsync } from '../util/comparer';
2export async function sequenceEqual(source, other, comparer = comparerAsync) {
3 const it1 = source[Symbol.asyncIterator]();
4 const it2 = other[Symbol.asyncIterator]();
5 let next1;
6 let next2;
7 while (!(next1 = await it1.next()).done) {
8 if (!(!(next2 = await it2.next()).done && (await comparer(next1.value, next2.value)))) {
9 return false;
10 }
11 }
12 return !!(await it2.next()).done;
13}
14
15//# sourceMappingURL=sequenceequal.mjs.map