Comparing version 2.5.0 to 2.6.0
@@ -0,1 +1,7 @@ | ||
# v2.6.0 | ||
- Added missing aliases for many methods. Previously, you could not (e.g.) `require('async/find')` or use `async.anyLimit`. (#1483) | ||
- Improved `queue` performance. (#1448, #1454) | ||
- Add missing sourcemap (#1452, #1453) | ||
- Various doc updates (#1448, #1471, #1483) | ||
# v2.5.0 | ||
@@ -2,0 +8,0 @@ - Added `concatLimit`, the `Limit` equivalent of [`concat`](https://caolan.github.io/async/docs.html#concat) ([#1426](https://github.com/caolan/async/issues/1426), [#1430](https://github.com/caolan/async/pull/1430)) |
166
index.js
@@ -66,84 +66,84 @@ /** | ||
import applyEach from './applyEach'; | ||
import applyEachSeries from './applyEachSeries'; | ||
import apply from './apply'; | ||
import asyncify from './asyncify'; | ||
import auto from './auto'; | ||
import autoInject from './autoInject'; | ||
import cargo from './cargo'; | ||
import compose from './compose'; | ||
import concat from './concat'; | ||
import concatLimit from './concatLimit'; | ||
import concatSeries from './concatSeries'; | ||
import constant from './constant'; | ||
import detect from './detect'; | ||
import detectLimit from './detectLimit'; | ||
import detectSeries from './detectSeries'; | ||
import dir from './dir'; | ||
import doDuring from './doDuring'; | ||
import doUntil from './doUntil'; | ||
import doWhilst from './doWhilst'; | ||
import during from './during'; | ||
import each from './each'; | ||
import eachLimit from './eachLimit'; | ||
import eachOf from './eachOf'; | ||
import eachOfLimit from './eachOfLimit'; | ||
import eachOfSeries from './eachOfSeries'; | ||
import eachSeries from './eachSeries'; | ||
import ensureAsync from './ensureAsync'; | ||
import every from './every'; | ||
import everyLimit from './everyLimit'; | ||
import everySeries from './everySeries'; | ||
import filter from './filter'; | ||
import filterLimit from './filterLimit'; | ||
import filterSeries from './filterSeries'; | ||
import forever from './forever'; | ||
import groupBy from './groupBy'; | ||
import groupByLimit from './groupByLimit'; | ||
import groupBySeries from './groupBySeries'; | ||
import log from './log'; | ||
import map from './map'; | ||
import mapLimit from './mapLimit'; | ||
import mapSeries from './mapSeries'; | ||
import mapValues from './mapValues'; | ||
import mapValuesLimit from './mapValuesLimit'; | ||
import mapValuesSeries from './mapValuesSeries'; | ||
import memoize from './memoize'; | ||
import nextTick from './nextTick'; | ||
import parallel from './parallel'; | ||
import parallelLimit from './parallelLimit'; | ||
import priorityQueue from './priorityQueue'; | ||
import queue from './queue'; | ||
import race from './race'; | ||
import reduce from './reduce'; | ||
import reduceRight from './reduceRight'; | ||
import reflect from './reflect'; | ||
import reject from './reject'; | ||
import reflectAll from './reflectAll'; | ||
import rejectLimit from './rejectLimit'; | ||
import rejectSeries from './rejectSeries'; | ||
import retry from './retry'; | ||
import retryable from './retryable'; | ||
import seq from './seq'; | ||
import series from './series'; | ||
import setImmediate from './setImmediate'; | ||
import some from './some'; | ||
import someLimit from './someLimit'; | ||
import someSeries from './someSeries'; | ||
import sortBy from './sortBy'; | ||
import timeout from './timeout'; | ||
import times from './times'; | ||
import timesLimit from './timesLimit'; | ||
import timesSeries from './timesSeries'; | ||
import transform from './transform'; | ||
import tryEach from './tryEach'; | ||
import unmemoize from './unmemoize'; | ||
import until from './until'; | ||
import waterfall from './waterfall'; | ||
import whilst from './whilst'; | ||
import apply from './apply' | ||
import applyEach from './applyEach' | ||
import applyEachSeries from './applyEachSeries' | ||
import asyncify from './asyncify' | ||
import auto from './auto' | ||
import autoInject from './autoInject' | ||
import cargo from './cargo' | ||
import compose from './compose' | ||
import concat from './concat' | ||
import concatLimit from './concatLimit' | ||
import concatSeries from './concatSeries' | ||
import constant from './constant' | ||
import detect from './detect' | ||
import detectLimit from './detectLimit' | ||
import detectSeries from './detectSeries' | ||
import dir from './dir' | ||
import doDuring from './doDuring' | ||
import doUntil from './doUntil' | ||
import doWhilst from './doWhilst' | ||
import during from './during' | ||
import each from './each' | ||
import eachLimit from './eachLimit' | ||
import eachOf from './eachOf' | ||
import eachOfLimit from './eachOfLimit' | ||
import eachOfSeries from './eachOfSeries' | ||
import eachSeries from './eachSeries' | ||
import ensureAsync from './ensureAsync' | ||
import every from './every' | ||
import everyLimit from './everyLimit' | ||
import everySeries from './everySeries' | ||
import filter from './filter' | ||
import filterLimit from './filterLimit' | ||
import filterSeries from './filterSeries' | ||
import forever from './forever' | ||
import groupBy from './groupBy' | ||
import groupByLimit from './groupByLimit' | ||
import groupBySeries from './groupBySeries' | ||
import log from './log' | ||
import map from './map' | ||
import mapLimit from './mapLimit' | ||
import mapSeries from './mapSeries' | ||
import mapValues from './mapValues' | ||
import mapValuesLimit from './mapValuesLimit' | ||
import mapValuesSeries from './mapValuesSeries' | ||
import memoize from './memoize' | ||
import nextTick from './nextTick' | ||
import parallel from './parallel' | ||
import parallelLimit from './parallelLimit' | ||
import priorityQueue from './priorityQueue' | ||
import queue from './queue' | ||
import race from './race' | ||
import reduce from './reduce' | ||
import reduceRight from './reduceRight' | ||
import reflect from './reflect' | ||
import reflectAll from './reflectAll' | ||
import reject from './reject' | ||
import rejectLimit from './rejectLimit' | ||
import rejectSeries from './rejectSeries' | ||
import retry from './retry' | ||
import retryable from './retryable' | ||
import seq from './seq' | ||
import series from './series' | ||
import setImmediate from './setImmediate' | ||
import some from './some' | ||
import someLimit from './someLimit' | ||
import someSeries from './someSeries' | ||
import sortBy from './sortBy' | ||
import timeout from './timeout' | ||
import times from './times' | ||
import timesLimit from './timesLimit' | ||
import timesSeries from './timesSeries' | ||
import transform from './transform' | ||
import tryEach from './tryEach' | ||
import unmemoize from './unmemoize' | ||
import until from './until' | ||
import waterfall from './waterfall' | ||
import whilst from './whilst' | ||
export default { | ||
apply: apply, | ||
applyEach: applyEach, | ||
applyEachSeries: applyEachSeries, | ||
apply: apply, | ||
asyncify: asyncify, | ||
@@ -226,3 +226,10 @@ auto: auto, | ||
all: every, | ||
allLimit: everyLimit, | ||
allSeries: everySeries, | ||
any: some, | ||
anyLimit: someLimit, | ||
anySeries: someSeries, | ||
find: detect, | ||
findLimit: detectLimit, | ||
findSeries: detectSeries, | ||
forEach: each, | ||
@@ -244,5 +251,5 @@ forEachSeries: eachSeries, | ||
export { | ||
apply as apply, | ||
applyEach as applyEach, | ||
applyEachSeries as applyEachSeries, | ||
apply as apply, | ||
asyncify as asyncify, | ||
@@ -347,1 +354,2 @@ auto as auto, | ||
}; | ||
@@ -22,2 +22,3 @@ import indexOf from 'lodash-es/_baseIndexOf'; | ||
var processingScheduled = false; | ||
function _insert(data, insertAtFront, callback) { | ||
@@ -50,3 +51,10 @@ if (callback != null && typeof callback !== 'function') { | ||
} | ||
setImmediate(q.process); | ||
if (!processingScheduled) { | ||
processingScheduled = true; | ||
setImmediate(function() { | ||
processingScheduled = false; | ||
q.process(); | ||
}); | ||
} | ||
} | ||
@@ -62,3 +70,5 @@ | ||
var index = indexOf(workersList, task, 0); | ||
if (index >= 0) { | ||
if (index === 0) { | ||
workersList.shift(); | ||
} else if (index > 0) { | ||
workersList.splice(index, 1); | ||
@@ -65,0 +75,0 @@ } |
@@ -7,3 +7,3 @@ 'use strict'; | ||
* Calls `callback` on a later loop around the event loop. In Node.js this just | ||
* calls `setImmediate`. In the browser it will use `setImmediate` if | ||
* calls `process.nextTicl`. In the browser it will use `setImmediate` if | ||
* available, otherwise `setTimeout(callback, 0)`, which means other higher | ||
@@ -18,3 +18,3 @@ * priority events may precede the execution of `callback`. | ||
* @method | ||
* @alias setImmediate | ||
* @see [async.setImmediate]{@link module:Utils.setImmediate} | ||
* @category Util | ||
@@ -21,0 +21,0 @@ * @param {Function} callback - The function to call on a later loop around |
{ | ||
"name": "async-es", | ||
"description": "Higher-order functions and common patterns for asynchronous code", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"main": "index.js", | ||
"author": "Caolan McMahon", | ||
"homepage": "https://caolan.github.io/async/", | ||
"repository": { | ||
@@ -8,0 +9,0 @@ "type": "git", |
@@ -8,5 +8,6 @@ ![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg) | ||
[![libhive - Open source examples](https://www.libhive.com/providers/npm/packages/async/examples/badge.svg)](https://www.libhive.com/providers/npm/packages/async) | ||
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async) | ||
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm install --save async`, it can also be used directly in the browser. | ||
Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm install --save async`, it can also be used directly in the browser. | ||
@@ -16,1 +17,36 @@ For Documentation, visit <https://caolan.github.io/async/> | ||
*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)* | ||
```javascript | ||
// for use with Node-style callbacks... | ||
var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; | ||
var configs = {}; | ||
async.forEachOf(obj, (value, key, callback) => { | ||
fs.readFile(__dirname + value, "utf8", (err, data) => { | ||
if (err) return callback(err); | ||
try { | ||
configs[key] = JSON.parse(data); | ||
} catch (e) { | ||
return callback(e); | ||
} | ||
callback(); | ||
}); | ||
}, err => { | ||
if (err) console.error(err.message); | ||
// configs is now a map of JSON data | ||
doSomethingWith(configs); | ||
}); | ||
``` | ||
```javascript | ||
// ...or ES2017 async functions | ||
async.mapLimit(urls, 5, async function(url) { | ||
const response = await fetch(url) | ||
return response.body | ||
}, (err, results) => { | ||
if (err) throw err | ||
// results is now an array of the response bodies | ||
console.log(results) | ||
}) | ||
``` |
@@ -79,4 +79,4 @@ import noop from 'lodash-es/noop'; | ||
* | ||
* // It can also be embedded within other control flow functions to retry | ||
* // individual methods that are not as reliable, like this: | ||
* // to retry individual methods that are not as reliable within other | ||
* // control flow functions, use the `retryable` wrapper: | ||
* async.auto({ | ||
@@ -83,0 +83,0 @@ * users: api.getUsers.bind(api), |
@@ -15,3 +15,3 @@ import setImmediate from './internal/setImmediate'; | ||
* @method | ||
* @alias nextTick | ||
* @see [async.nextTick]{@link module:Utils.nextTick} | ||
* @category Util | ||
@@ -18,0 +18,0 @@ * @param {Function} callback - The function to call on a later loop around |
@@ -26,3 +26,3 @@ import noop from 'lodash-es/noop'; | ||
* @example | ||
* async.try([ | ||
* async.tryEach([ | ||
* function getDataFromFirstWebsite(callback) { | ||
@@ -29,0 +29,0 @@ * // Try getting the data from the first website |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
231360
129
5288
0
51