node-filter-async
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

node-filter-async

Build Status npm version Node.js Version

Filter array elements with Promises, zero dependencies, written in TypeScript.

Installation

npm i node-filter-async

Usage

API

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

Example:

import filterAsync from 'node-filter-async';

(async () => {
  const results = await filterAsync(someArray, async (value, index) => {
    console.log(`filtering [${index}]: ${value}`);
    return (await asyncFunc(value)) === 'blablabla';
  });
})();

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.0184latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.0184
2.0.06,253
1.1.455
1.1.37
1.1.20
1.1.14
1.0.12
1.0.00
0.0.46
0.0.31
0.0.23
0.0.11

Package Sidebar

Install

npm i node-filter-async

Weekly Downloads

6,516

Version

3.0.0

License

MIT

Unpacked Size

4.53 kB

Total Files

6

Last publish

Collaborators

  • mgenware