Skip to content
김태헌 edited this page Sep 26, 2024 · 3 revisions

예시 1: 기본 사용법

import { some } from 'mori-ts';

const arr = [1, 2, 3, 4, 5];
const result = some(item => item > 3, arr);

console.log(result); // true

예시 2: 파이프라인과 함께 사용하기

import { pipe, map, filter, some, toAsync } from 'mori-ts';

const result = pipe(
  [1, 2, 3, 4, 5],
  map(item => item * 2),
  filter(item => item > 5),
  some(item => item > 10)
);

console.log(result); // false

const result2 = pipe(
  [1, 2, 3, 4, 5],
  toAsync,
  map(item => item * 2),
  filter(item => item > 5),
  some(item => item > 10)
);

console.log(result2); // false

테스트 코드 링크

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

Clone this wiki locally