Comparing version 3.2.3 to 3.2.4
@@ -0,1 +1,5 @@ | ||
# v3.2.4 | ||
- Fix a bug in `priorityQueue` where it didn't wait for the result. (#1725) | ||
- Fix a bug where `unshiftAsync` was included in `priorityQueue`. (#1790) | ||
# v3.2.3 | ||
@@ -2,0 +6,0 @@ - Fix bugs in comment parsing in `autoInject`. (#1767, #1780) |
@@ -30,3 +30,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns A Promise, if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
* @example | ||
@@ -33,0 +33,0 @@ * |
@@ -26,3 +26,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns a Promise if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
*/ | ||
@@ -29,0 +29,0 @@ function detectLimit(coll, limit, iteratee, callback) { |
@@ -24,3 +24,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns a Promise if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
*/ | ||
@@ -27,0 +27,0 @@ function detectSeries(coll, iteratee, callback) { |
@@ -30,3 +30,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns A Promise, if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
* @example | ||
@@ -33,0 +33,0 @@ * |
@@ -26,3 +26,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns a Promise if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
*/ | ||
@@ -29,0 +29,0 @@ function detectLimit(coll, limit, iteratee, callback) { |
@@ -24,3 +24,3 @@ import createTester from './internal/createTester.js' | ||
* (err, result). | ||
* @returns a Promise if no callback is passed | ||
* @returns {Promise} a promise, if a callback is omitted | ||
*/ | ||
@@ -27,0 +27,0 @@ function detectSeries(coll, iteratee, callback) { |
@@ -63,8 +63,7 @@ import onlyOnce from './onlyOnce.js' | ||
var item = { | ||
var item = q._createTaskItem( | ||
data, | ||
callback: rejectOnError ? | ||
promiseCallback : | ||
rejectOnError ? promiseCallback : | ||
(callback || promiseCallback) | ||
}; | ||
); | ||
@@ -151,2 +150,8 @@ if (insertAtFront) { | ||
_tasks: new DLL(), | ||
_createTaskItem (data, callback) { | ||
return { | ||
data, | ||
callback | ||
}; | ||
}, | ||
*[Symbol.iterator] () { | ||
@@ -153,0 +158,0 @@ yield* q._tasks[Symbol.iterator]() |
{ | ||
"name": "async-es", | ||
"description": "Higher-order functions and common patterns for asynchronous code", | ||
"version": "3.2.3", | ||
"version": "3.2.4", | ||
"main": "index.js", | ||
@@ -22,7 +22,7 @@ "author": "Caolan McMahon", | ||
"devDependencies": { | ||
"@babel/eslint-parser": "^7.16.5", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.6", | ||
"babel-minify": "^0.5.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-istanbul": "^5.1.4", | ||
"babel-plugin-add-module-exports": "^1.0.4", | ||
"babel-plugin-istanbul": "^6.1.1", | ||
"babel-plugin-syntax-async-generators": "^6.13.0", | ||
@@ -33,38 +33,33 @@ "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
"babel-register": "^6.26.0", | ||
"babelify": "^8.0.0", | ||
"babelify": "^10.0.0", | ||
"benchmark": "^2.1.1", | ||
"bluebird": "^3.4.6", | ||
"browserify": "^16.2.3", | ||
"browserify": "^17.0.0", | ||
"chai": "^4.2.0", | ||
"cheerio": "^0.22.0", | ||
"coveralls": "^3.0.4", | ||
"es6-promise": "^2.3.0", | ||
"eslint": "^6.0.1", | ||
"eslint-plugin-prefer-arrow": "^1.1.5", | ||
"fs-extra": "^0.26.7", | ||
"es6-promise": "^4.2.8", | ||
"eslint": "^8.6.0", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"fs-extra": "^10.0.0", | ||
"jsdoc": "^3.6.2", | ||
"karma": "^4.1.0", | ||
"karma-browserify": "^5.3.0", | ||
"karma-edge-launcher": "^0.4.2", | ||
"karma-firefox-launcher": "^1.1.0", | ||
"karma-junit-reporter": "^1.2.0", | ||
"karma-mocha": "^1.2.0", | ||
"karma": "^6.3.12", | ||
"karma-browserify": "^8.1.0", | ||
"karma-firefox-launcher": "^2.1.2", | ||
"karma-mocha": "^2.0.1", | ||
"karma-mocha-reporter": "^2.2.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"mocha": "^6.1.4", | ||
"mocha-junit-reporter": "^1.18.0", | ||
"native-promise-only": "^0.8.0-a", | ||
"nyc": "^14.1.1", | ||
"rollup": "^0.63.4", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"nyc": "^15.1.0", | ||
"rollup": "^2.66.1", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-npm": "^2.0.0", | ||
"rsvp": "^3.0.18", | ||
"semver": "^5.5.0", | ||
"yargs": "^11.0.0" | ||
"rsvp": "^4.8.5", | ||
"semver": "^7.3.5", | ||
"yargs": "^17.3.1" | ||
}, | ||
"scripts": { | ||
"coverage": "nyc npm run mocha-node-test -- --grep @nycinvalid --invert", | ||
"coveralls": "npm run coverage && nyc report --reporter=text-lcov | coveralls", | ||
"jsdoc": "jsdoc -c ./support/jsdoc/jsdoc.json && node support/jsdoc/jsdoc-fix-html.js", | ||
"lint": "eslint --fix lib/ test/ perf/memory.js perf/suites.js perf/benchmark.js support/build/ support/*.js karma.conf.js", | ||
"lint": "eslint --fix .", | ||
"mocha-browser-test": "karma start", | ||
@@ -71,0 +66,0 @@ "mocha-node-test": "mocha", |
@@ -1,2 +0,1 @@ | ||
import setImmediate from './setImmediate.js' | ||
import queue from './queue.js' | ||
@@ -22,7 +21,9 @@ import Heap from './internal/Heap.js' | ||
* `1`. If the concurrency is `0`, an error is thrown. | ||
* @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two | ||
* @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are three | ||
* differences between `queue` and `priorityQueue` objects: | ||
* * `push(task, priority, [callback])` - `priority` should be a number. If an | ||
* array of `tasks` is given, all tasks will be assigned the same priority. | ||
* * The `unshift` method was removed. | ||
* * `pushAsync(task, priority, [callback])` - the same as `priorityQueue.push`, | ||
* except this returns a promise that rejects if an error occurs. | ||
* * The `unshift` and `unshiftAsync` methods were removed. | ||
*/ | ||
@@ -32,43 +33,38 @@ export default function(worker, concurrency) { | ||
var q = queue(worker, concurrency); | ||
var processingScheduled = false; | ||
var { | ||
push, | ||
pushAsync | ||
} = q; | ||
q._tasks = new Heap(); | ||
q._createTaskItem = ({data, priority}, callback) => { | ||
return { | ||
data, | ||
priority, | ||
callback | ||
}; | ||
}; | ||
// Override push to accept second parameter representing priority | ||
q.push = function(data, priority = 0, callback = () => {}) { | ||
if (typeof callback !== 'function') { | ||
throw new Error('task callback must be a function'); | ||
function createDataItems(tasks, priority) { | ||
if (!Array.isArray(tasks)) { | ||
return {data: tasks, priority}; | ||
} | ||
q.started = true; | ||
if (!Array.isArray(data)) { | ||
data = [data]; | ||
} | ||
if (data.length === 0 && q.idle()) { | ||
// call drain immediately if there are no tasks | ||
return setImmediate(() => q.drain()); | ||
} | ||
return tasks.map(data => { return {data, priority}; }); | ||
} | ||
for (var i = 0, l = data.length; i < l; i++) { | ||
var item = { | ||
data: data[i], | ||
priority, | ||
callback | ||
}; | ||
// Override push to accept second parameter representing priority | ||
q.push = function(data, priority = 0, callback) { | ||
return push(createDataItems(data, priority), callback); | ||
}; | ||
q._tasks.push(item); | ||
} | ||
if (!processingScheduled) { | ||
processingScheduled = true; | ||
setImmediate(() => { | ||
processingScheduled = false; | ||
q.process(); | ||
}); | ||
} | ||
q.pushAsync = function(data, priority = 0, callback) { | ||
return pushAsync(createDataItems(data, priority), callback); | ||
}; | ||
// Remove unshift function | ||
// Remove unshift functions | ||
delete q.unshift; | ||
delete q.unshiftAsync; | ||
return q; | ||
} |
@@ -21,3 +21,3 @@ import once from './internal/once.js' | ||
* completed. Invoked with (err, result). | ||
* @returns undefined | ||
* @returns {Promise} a promise, if a callback is omitted | ||
* @example | ||
@@ -24,0 +24,0 @@ * |
![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg) | ||
[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) | ||
[![Build Status via Azure Pipelines](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | ||
![Github Actions CI status](https://github.com/caolan/async/actions/workflows/ci.yml/badge.svg) | ||
[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async) | ||
@@ -10,7 +9,2 @@ [![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) | ||
<!-- | ||
|Linux|Windows|MacOS| | ||
|-|-|-| | ||
|[![Linux Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Linux&configuration=Linux%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![Windows Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Windows&configuration=Windows%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![MacOS Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=OSX&configuration=OSX%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)| | ||
--> | ||
@@ -17,0 +11,0 @@ 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. |
@@ -24,3 +24,3 @@ import once from './internal/once.js' | ||
* callback. Invoked with (err, [results]). | ||
* @returns undefined | ||
* @returns {Promise} a promise, if a callback is omitted | ||
* @example | ||
@@ -27,0 +27,0 @@ * |
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
36
7705
311982
59