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

예시 1: 배열에서 사용

import { every } from 'mori-ts';

const arr = [1, 2, 3];
const result = every(x => x > 0, arr);

console.log(result); // 출력: true

예시 2: 파이프라인에서 사용

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

const arr = [1, 2, 3];

const result = pipe(
  arr,
  map(x => x * 2),
  every(x => x > 0),
);

console.log(result); // 출력: true

const result2 = await pipe(
  arr,
  toAsync,
  map(x => x * 2),
  every(x => x > 0),
);

console.log(result); // 출력: true

테스트 코드 링크

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

Clone this wiki locally