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