Comparing version 2.0.0-rc.2 to 2.0.0-rc.3
'use strict'; | ||
import applyEach from './internal/applyEach'; | ||
import eachOf from './eachOf'; | ||
import map from './map'; | ||
export default applyEach(eachOf); | ||
export default applyEach(map); |
'use strict'; | ||
import applyEach from './internal/applyEach'; | ||
import eachOfSeries from './eachOfSeries'; | ||
import mapSeries from './mapSeries'; | ||
export default applyEach(eachOfSeries); | ||
export default applyEach(mapSeries); |
@@ -5,7 +5,7 @@ 'use strict'; | ||
import forOwn from 'lodash-es/forOwn'; | ||
import indexOf from 'lodash-es/indexOf'; | ||
import indexOf from 'lodash-es/_baseIndexOf'; | ||
import isArray from 'lodash-es/isArray'; | ||
import okeys from 'lodash-es/keys'; | ||
import noop from 'lodash-es/noop'; | ||
import once from 'lodash-es/once'; | ||
import once from './internal/once'; | ||
import rest from 'lodash-es/rest'; | ||
@@ -61,3 +61,3 @@ | ||
} | ||
if (isArray(dep) && indexOf(dep, key) >= 0) { | ||
if (isArray(dep) && indexOf(dep, key, 0) >= 0) { | ||
throw new Error('async.auto task `' + key + | ||
@@ -64,0 +64,0 @@ '`Has cyclic dependencies'); |
import auto from './auto'; | ||
import forOwn from 'lodash-es/forOwn'; | ||
import arrayMap from 'lodash-es/_arrayMap'; | ||
import clone from 'lodash-es/_baseClone'; | ||
import clone from 'lodash-es/_copyArray'; | ||
import isArray from 'lodash-es/isArray'; | ||
@@ -45,3 +45,19 @@ | ||
auto(newTasks, callback); | ||
auto(newTasks, function (err, results) { | ||
var params; | ||
if (isArray(callback)) { | ||
params = clone(callback); | ||
callback = params.pop(); | ||
} else { | ||
params = parseParams(callback); | ||
params.shift(); | ||
} | ||
params = arrayMap(params, function (name) { | ||
return results[name]; | ||
}); | ||
params.unshift(err); | ||
callback.apply(null, params); | ||
}); | ||
} |
@@ -27,10 +27,12 @@ # v2.0.0 | ||
- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. (#568, #1038) | ||
- Array methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. (#579, #839, #1074) | ||
- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. (#579, #839, #1074) | ||
- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. (#1007, #1027) | ||
- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. (#942, #1012, #1095) | ||
- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. (#1016, #1052) | ||
- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. (#940, #1053) | ||
- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. (#608, #1055) | ||
- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. (#608, #1055, #1099, #1100) | ||
- You can now limit the concurrency of `auto` tasks. (#635, #637) | ||
- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. | ||
- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. (#1058) | ||
- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. (#868, #1030, #1033, #1034) | ||
- `applyEach` and `applyEachSeries` now pass results to the final callback. (#1088) | ||
@@ -44,3 +46,3 @@ ## Breaking changes | ||
- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. (#778, #847) | ||
- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. | ||
- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. (#1054, #1058) | ||
- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. (#724, #1078) | ||
@@ -47,0 +49,0 @@ |
@@ -50,3 +50,5 @@ 'use strict'; | ||
import reduceRight from './reduceRight'; | ||
import reflect from './reflect'; | ||
import reject from './reject'; | ||
import reflectAll from './reflectAll'; | ||
import rejectLimit from './rejectLimit'; | ||
@@ -121,2 +123,4 @@ import rejectSeries from './rejectSeries'; | ||
reduceRight: reduceRight, | ||
reflect: reflect, | ||
reflectAll: reflectAll, | ||
reject: reject, | ||
@@ -210,2 +214,4 @@ rejectLimit: rejectLimit, | ||
reduceRight as reduceRight, | ||
reflect as reflect, | ||
reflectAll as reflectAll, | ||
reject as reject, | ||
@@ -212,0 +218,0 @@ rejectLimit as rejectLimit, |
@@ -10,6 +10,5 @@ 'use strict'; | ||
var that = this; | ||
return eachfn(fns, function (fn, _, cb) { | ||
return eachfn(fns, function (fn, cb) { | ||
fn.apply(that, args.concat([cb])); | ||
}, | ||
callback); | ||
}, callback); | ||
}); | ||
@@ -16,0 +15,0 @@ if (args.length) { |
'use strict'; | ||
import noop from 'lodash-es/noop'; | ||
@@ -30,5 +31,7 @@ export default function _createTester(eachfn, check, getResult) { | ||
if (arguments.length > 3) { | ||
cb = cb || noop; | ||
eachfn(arr, limit, wrappedIteratee, done); | ||
} else { | ||
cb = iteratee; | ||
cb = cb || noop; | ||
iteratee = limit; | ||
@@ -35,0 +38,0 @@ eachfn(arr, wrappedIteratee, done); |
'use strict'; | ||
import noop from 'lodash-es/noop'; | ||
import once from 'lodash-es/once'; | ||
import once from './once'; | ||
@@ -6,0 +6,0 @@ import iterator from './iterator'; |
@@ -6,4 +6,4 @@ import rest from 'lodash-es/rest'; | ||
var callback = args.pop(); | ||
fn(args, callback); | ||
fn.call(this, args, callback); | ||
}); | ||
} |
@@ -6,3 +6,3 @@ 'use strict'; | ||
import noop from 'lodash-es/noop'; | ||
import once from 'lodash-es/once'; | ||
import once from './once'; | ||
@@ -9,0 +9,0 @@ export default function _asyncMap(eachfn, arr, iteratee, callback) { |
@@ -5,3 +5,2 @@ 'use strict'; | ||
import rest from 'lodash-es/rest'; | ||
import has from 'lodash-es/has'; | ||
@@ -11,2 +10,6 @@ import setImmediate from './internal/setImmediate'; | ||
function has(obj, key) { | ||
return key in obj; | ||
} | ||
export default function memoize(fn, hasher) { | ||
@@ -13,0 +16,0 @@ var memo = Object.create(null); |
{ | ||
"name": "async-es", | ||
"description": "Higher-order functions and common patterns for asynchronous code", | ||
"version": "2.0.0-rc.2", | ||
"version": "2.0.0-rc.3", | ||
"main": "index.js", | ||
@@ -35,4 +35,3 @@ "author": "Caolan McMahon", | ||
"es6-promise": "^2.3.0", | ||
"fs-extra": "^0.26.3", | ||
"gulp": "~3.9.0", | ||
"fs-extra": "^0.26.7", | ||
"jscs": "^1.13.1", | ||
@@ -52,2 +51,3 @@ "jshint": "~2.8.0", | ||
"rollup": "^0.25.0", | ||
"rollup-plugin-node-resolve": "^1.5.0", | ||
"rollup-plugin-npm": "~1.3.0", | ||
@@ -57,4 +57,2 @@ "rsvp": "^3.0.18", | ||
"uglify-js": "~2.4.0", | ||
"vinyl-buffer": "~1.0.0", | ||
"vinyl-source-stream": "~1.1.0", | ||
"yargs": "~3.9.1" | ||
@@ -65,3 +63,3 @@ }, | ||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", | ||
"lint": "jshint lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js && jscs lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js", | ||
"lint": "jshint lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ karma.conf.js && jscs lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ karma.conf.js", | ||
"mocha-browser-test": "karma start", | ||
@@ -71,5 +69,5 @@ "mocha-node-test": "mocha mocha_test/ --compilers js:babel-core/register", | ||
"nodeunit-test": "nodeunit test/test-async.js", | ||
"test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test" | ||
"test": "npm run-script lint && npm run nodeunit-test && npm run mocha-node-test" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -6,3 +6,3 @@ 'use strict'; | ||
import noop from 'lodash-es/noop'; | ||
import once from 'lodash-es/once'; | ||
import once from './internal/once'; | ||
@@ -9,0 +9,0 @@ export default function race(tasks, cb) { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
export default function timeout(asyncFn, miliseconds) { | ||
export default function timeout(asyncFn, miliseconds, info) { | ||
var originalCallback, timer; | ||
@@ -18,4 +18,8 @@ var timedOut = false; | ||
function timeoutCallback() { | ||
var error = new Error('Callback function timed out.'); | ||
var name = asyncFn.name || 'anonymous'; | ||
var error = new Error('Callback function "' + name + '" timed out.'); | ||
error.code = 'ETIMEDOUT'; | ||
if (info) { | ||
error.info = info; | ||
} | ||
timedOut = true; | ||
@@ -22,0 +26,0 @@ originalCallback(error); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
import noop from 'lodash-es/noop'; | ||
import once from 'lodash-es/once'; | ||
import once from './internal/once'; | ||
import rest from 'lodash-es/rest'; | ||
@@ -8,0 +8,0 @@ |
Sorry, the diff of this file is too big to display
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
32
98
1580
2184
0
134317