Skip to content

toArray

김태헌 edited this page Sep 26, 2024 · 4 revisions

예시 1: 기본 사용법

import { toArray } from 'mori-ts';

const iter = [1, 2, 3];
const result = toArray(iter); // [1, 2, 3]

예시 2: 비동기 iterable 처리

import { toArray } from 'mori-ts';

async function* asyncIterable() {
  yield 1;
  yield 2;
  yield 3;
}

const result = await toArray(asyncIterable()); // [1, 2, 3]

테스트 코드 링크

https://github.com/gangnamssal/mori-ts/blob/main/src/test/to-array.spec.ts

Clone this wiki locally