-
Notifications
You must be signed in to change notification settings - Fork 0
zip
김태헌 edited this page Sep 26, 2024
·
5 revisions
import { zip } from 'mori-ts';
const result = zip([1, 2, 3], ['a', 'b', 'c']);
// 결과: [[1, 'a'], [2, 'b'], [3, 'c']]
import { zip } from 'mori-ts';
const result1 = zip([1, 2, 3], ['a', 'b']);
// 결과: [[1, 'a'], [2, 'b']]
const result2 = zip([1, 2], ['a', 'b', 'c']);
// 결과: [[1, 'a'], [2, 'b']]
import { zip, pipe, toArray, toAsync } from 'mori-ts';
const iter1 = [1, 2, 3];
const iter2 = ['a', 'b', 'c'];
const res = pipe(iter2, zip(iter1), toArray);
// 결과: [[1, 'a'], [2, 'b'], [3, 'c']]
const res2 = pipe(iter2, toAsync, zip(iter1), toArray);
// 결과: [[1, 'a'], [2, 'b'], [3, 'c']]
https://github.com/gangnamssal/mori-ts/blob/main/src/test/zip.spec.ts