Adding missing 'zip' function

This commit is contained in:
Caio Lima 2020-01-27 13:40:16 -03:00 committed by Rick Waldron
parent 1337f11e21
commit 2e6a371f71
1 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,13 @@ features: [Intl.DateTimeFormat-fractionalSecondDigits, Intl.DateTimeFormat-forma
locale: [en-US]
---*/
function* zip(a, b) {
assert.sameValue(a.length, b.length);
for (let i = 0; i < a.length; ++i) {
yield [i, a[i], b[i]];
}
}
function compare(actual, expected) {
for (const [i, actualEntry, expectedEntry] of zip(actual, expected)) {
assert.sameValue(actualEntry.type, expectedEntry.type, `type for entry ${i}`);