Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 2.44 KB

filter.md

File metadata and controls

43 lines (35 loc) · 2.44 KB

Async Agent

A javascript library of async functions

npm build coverage deps size vulnerabilities license


filter(array, callback, [settings]) ⇒ Promise

Create a new array with all the elements of an array that pass an async test.

Returns: Promise - The promise is resolved with a new array of all the values that passed the test.

Param Type Default Description
array Array An array to iterate over.
callback function Parameters: element, index, and array.
Context: same as that provided to the main function.
Return: A truthy value to include this element in the final result.
May return a Promise. Rejections are not caught and any work done up to that point will be lost.
[settings] object Optional settings object.
[settings.down] boolean false Decrement the index on each iteration from highest to lowest.
[settings.delay] number 0 Delay before calls in ms. Can be updated at any time to effect the delay before future calls.