Methods
every(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#every()
method.
Test if all elements in array
pass the test implemented in callback
.
Callbacks are run concurrently, meaning that all the callbacks are going to run even if any of the first elements do not pass the test,
depending on the async calls you are going to use, consider using instead everySeries()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with true as value if all elements passed the test, otherwise false.
- Type
- Promise
everySeries(array, callback, thisArgopt) → {Promise}
Same functionality as every()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with true as value if all elements passed the test, otherwise false.
- Type
- Promise
filter(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#filter()
method.
Creates a new array with the elements that passed the test implemented in callback
.
Callbacks are run concurrently.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the resultant filtered Array as value.
- Type
- Promise
filterSeries(array, callback) → {Promise}
Same functionality as filter()
, but runs only one callback at a time.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | Array to iterate over. |
callback |
function | Function to apply each item in |
- Source:
Returns:
- Returns a Promise with the resultant filtered Array as value.
- Type
- Promise
find(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#find()
method.
Returns the value of the element that satisfies the provided callback
. The value returned is the one found first.
Callbacks are run concurrently, meaning that all the callbacks are going to run even if the returned value is found in one of the first elements of array
,
depending on the async calls you are going to use, consider using instead findSeries()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the element that passed the test as value, otherwise undefined.
- Type
- Promise
findIndex(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#findIndex()
method.
Returns the index of the element that satisfies the provided callback
. The index returned is the one found first.
Callbacks are run concurrently, meaning that all the callbacks are going to run even if the returned index is found in one of the first elements of array
,
depending on the async calls you are going to use, consider using instead findSeries()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the index that passed the test as value, otherwise -1.
- Type
- Promise
findIndexSeries(array, callback, thisArgopt) → {Promise}
Same functionality as findIndex()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the index that passed the test, otherwise -1.
- Type
- Promise
findSeries(array, callback, thisArgopt) → {Promise}
Same functionality as find()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the element that passed the test as value, otherwise undefined.
- Type
- Promise
forEach(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#forEach()
method.
Executes the provided callback once for each element.
Callbacks are run concurrently,
and are only invoked for properties of the array that have been initialized (including those initialized with undefined), for unassigned ones callback
is not run.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with undefined value.
- Type
- Promise
forEachSeries(array, callback, thisArgopt) → {Promise}
Same functionality as forEach()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with undefined value.
- Type
- Promise
map(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#map()
method.
Creates a new array with the results of calling the provided callback once for each element.
Callbacks are run concurrently,
and are only invoked for properties of the array that have been initialized (including those initialized with undefined), for unassigned onescallback
is not run.
Resultant Array is always the same length as the original one.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the resultant Array as value.
- Type
- Promise
mapSeries(array, callback, thisArgopt) → {Promise}
Same functionality as map()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with the resultant Array as value.
- Type
- Promise
reduce(array, callback, initialValueopt) → {Promise}
Implements ES5 Array#reduce()
method.
Applies a callback
against an accumulator and each element in array
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
initialValue |
Object |
<optional> |
Used as first argument to the first call of |
- Source:
Returns:
- Returns a Promise with the resultant value from the reduction.
- Type
- Promise
some(array, callback, thisArgopt) → {Promise}
Implements ES5 Array#some()
method.
Test if some element in array
passes the test implemented in callback
.
Callbacks are run concurrently, meaning that all the callbacks are going to run even if some of the first elements pass the test,
depending on the async calls you are going to use, consider using instead someSeries()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with true as value if some element passed the test, otherwise false.
- Type
- Promise
someSeries(array, callback, thisArgopt) → {Promise}
Same functionality as some()
, but runs only one callback at a time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
array |
Array | Array to iterate over. |
|
callback |
function | Function to apply each item in |
|
thisArg |
Object |
<optional> |
Value to use as this when executing the |
- Source:
Returns:
- Returns a Promise with true as value if some element passed the test, otherwise false.
- Type
- Promise