Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 565 Bytes

README.md

File metadata and controls

34 lines (25 loc) · 565 Bytes

node-async-filter

Filter array in an async way written in TypeScript.

Installation

npm i node-async-filter

Usage

API

asyncFilter<T>(
  // The array to be filtered.
  array: T[],
  // The async filter callback.
  callback: (value: T, index: number) => Promise<boolean>,
): Promise<T[]>;

Example:

import { asyncFilter } from "node-async-filter ";

(async () => {
  const results = await asyncFilter(someArray, async (value, index) => {
    return (await asyncFunc(value)) === 'myCheckingValue';
  });
})();