-
Notifications
You must be signed in to change notification settings - Fork 0
map
김태헌 edited this page Sep 26, 2024
·
4 revisions
import { map } from 'mori-ts';
const array = [1, 2, 3];
const result = map(value => value * 2, array);
console.log([...result]); // 출력: [2, 4, 6]
import { map } from 'mori-ts';
const promise = Promise.resolve([1, 2, 3]);
const result = map(value => value * 2, await promise);
console.log([...result]); // 출력: [2, 4, 6]
import { pipe, toAsync, map, toArray } from 'mori-ts';
const res = pipe(
[1, 2, 3],
map(value => value * 2),
toArray,
); // 출력: [2, 4, 6]
const res2 = await pipe(
[1, 2, 3],
toAsync,
map(value => value * 2),
toArray,
); // 출력: [2, 4, 6]
https://github.com/gangnamssal/mori-ts/blob/main/src/test/map.spec.ts