Detalhes do pacote

async-agent

DarrenPaulWright181MIT0.5.8

A javascript library of async functions

defer, delay, clear, wait

readme (leia-me)

Async Agent

A javascript library of async functions

npm build coverage deps size vulnerabilities license


Installation

npm install async-agent

Requires Babel 7.2+


Functions

clear(id)

Clears a defer or delay callback.

debounce(callback, [duration], [options])function

Returns a new debounced function that waits to call the callback until duration ms have passed since the last time it was called.

defer(callback)number

Defers the calling of a callback until the current stack is complete.

delay(callback, [duration])number

Delays the calling of a callback for a given amount of time.

throttle(callback, [duration], [options])function

Returns a new throttled function that waits to call the callback until duration ms have passed. Any calls to it during that time will do nothing.

wait([duration])Promise

Delays the resolving of a new Promise for a given amount of time. Provides the same functionality as defer and delay, but with promises. Also serves as a wrapper for a Promise if a callback is provided in place of duration.

#### Higher-order Functions
rejectAfterBy(duration, callback)function

Returns a function that returns a Promise that rejects with the results of a callback after a delay.

rejectAfterWith([duration], [args])function

Returns a function that returns a Promise that rejects with provided args after a delay.

rejectBy([callback])function

Returns a function that returns a Promise that rejects with the results of a callback.

resolveWith([...args])function

Returns a function that returns a Promise that rejects with provided args.

resolveAfterBy(duration, callback)function

Returns a function that returns a Promise that resolves with the results of a callback after a delay.

resolveAfterWith([duration], [arg])function

Returns a function that returns a Promise that resolves with provided args after a delay.

resolveBy([callback])function

Returns a function that returns a Promise that resolves with the results of a callback.

resolveWith([arg])function

Returns a function that returns a Promise that resolves with provided args.

waitBy(callback)function

Returns a function that returns a Promise that calls a callback.

#### Iterator Functions
discard(array, callback, [settings])Promise

Discard elements from an array, in place, that pass an async test. The array is only mutated if and when all iterations are completed successfully.

each(array, callback, [settings])Promise

Execute an async callback for each element in an array.

every(array, callback, [settings])Promise

Determine whether every element in an array passes an async test.

filter(array, callback, [settings])Promise

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

find(array, callback, [settings])Promise

Gets the first element in an array that passes an async test, or undefined if no element passes the test.

findIndex(array, callback, [settings])Promise

Gets the index of the first element in an array that passes an async test, or -1 if no element passes the test.

includes(array, value, [settings])Promise

Determines if an element is in an array. Uses SameValue comparison performed async.

indexOf(array, value, [settings])Promise

Gets the index of an element in an array, or -1 if the element is not found in the array. Uses SameValue comparison performed async.

map(array, callback, [settings])Promise

Create a new array populated with the results of calling an async callback on every element in an array.

reduce(array, callback, initialValue, [settings])Promise

Calls an async callback on each element of an array, reducing the array to a single output value.

some(array, callback, [settings])Promise

Determine whether at least one element in an array passes an async test.

#### Repeater Functions
fill(length, [callback], [settings])Promise

Returns an array of specified length filled with either the index value or the value returned from an async callback.

forRange(first, last, callback, [settings])Promise

Calls an async callback for each integer within a range.

repeat(times, callback, [settings])Promise

Calls an async callback a specified number of times.

until(callback, [settings])Promise

Calls an async callback until true is returned.

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning

0.5.0 - 2020-03-13

Added

Security

  • Updating dependencies

0.4.6 - 2020-01-15

Security

  • Preparing for future versions of node.

0.4.5 - 2019-12-26

Security

  • Updating dependencies

0.4.4 - 2019-12-06

Security

  • Updating dependencies

0.4.3 - 2019-10-21

Security

  • Updating dependencies

0.4.2 - 2019-08-28

Security

  • Updating dependencies

0.4.1 - 2019-08-01

Fixed

  • Fixed resolveWith and resolveAfterWith

0.4.0 - 2019-07-31

Added

0.3.3 - 2019-07-29

Security

  • Updating dependencies

0.3.2 - 2019-06-11

  • Updating documentation

0.3.1 - 2019-06-06

  • Fixing tests

0.3.0 - 2019-03-15

Added

0.2.0 - 2019-03-13

Added

0.1.0 - 2019-03-13

Added