Class: Filter

rg-async. Filter

Defines a Filter class. Provides two methods (filter that will run in parallel and filterSeries that will run in series).


new Filter()

Author:
Source:

Methods


<static> filter(srcArray, predicate)

Invokes in parallel an async predicate function on each item in the given source Array.

Invokes in parallel an async predicate function on each item in the given source Array. This will return a promise to be resolved containing the new array with the items that predicate function returned a truthy value.

Parameters:
Name Type Description
srcArray Array

Specifies the source array to filter over.

predicate function

Specifies the async function that will be called with (value, index, array) as arguments and returns true to keep the value in the resulting filtered array.

Source:
Returns:

Returns a promise to be resolved containing the new array with the filtered items.

Type
Promise