-
Notifications
You must be signed in to change notification settings - Fork 0
each
김태헌 edited this page Sep 26, 2024
·
6 revisions
import { each } from 'mori-ts';
const arr = [1, 2, 3];
let sum = 0;
each(x => sum += x, arr);
console.log(sum); // 출력: 6
import { pipe, toArray, each } from 'mori-ts';
const logMessage = (message) => {
console.log(message);
};
const arr = [1, 2, 3];
const res = pipe(arr, each(logMessage), toArray); // 콘솔 출력: 1, 2, 3
console.log(res); // 출력: [1, 2, 3]
https://github.com/gangnamssal/mori-ts/blob/main/src/test/each.spec.ts