-
Notifications
You must be signed in to change notification settings - Fork 0
take
김태헌 edited this page Sep 26, 2024
·
4 revisions
import { take } from 'mori-ts';
const arr = [1, 2, 3, 4, 5];
const result = take(3, arr);
console.log([...result]); // [1, 2, 3]
import { pipe, toArray, toAsync } from 'mori-ts';
const result = pipe([1, 2, 3, 4, 5], take(3), toArray);
console.log(result); // [1, 2, 3]
const result2 = await pipe([1, 2, 3, 4, 5], toAsync, take(3), toArray);
console.log(result2); // [1, 2, 3]
https://github.com/gangnamssal/mori-ts/blob/main/src/test/take.spec.ts