+24
| { | ||
| // Enforcing options | ||
| "eqeqeq": false, | ||
| "forin": true, | ||
| "indent": 4, | ||
| "noarg": true, | ||
| "undef": true, | ||
| "trailing": true, | ||
| "evil": true, | ||
| "laxcomma": true, | ||
| // Relaxing options | ||
| "onevar": false, | ||
| "asi": false, | ||
| "eqnull": true, | ||
| "expr": false, | ||
| "loopfunc": true, | ||
| "sub": true, | ||
| "browser": true, | ||
| "node": true, | ||
| "globals": { | ||
| "define": true | ||
| } | ||
| } |
+16
| # v1.0.0 | ||
| No known breaking changes, we are simply complying with semver from here on out. | ||
| Changes: | ||
| - Start using a changelog! | ||
| - Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) (#168 #704 #321) | ||
| - Detect deadlocks in `auto` (#663) | ||
| - Better support for require.js (#527) | ||
| - Throw if queue created with concurrency `0` (#714) | ||
| - Fix unneeded iteration in `queue.resume()` (#758) | ||
| - Guard against timer mocking overriding `setImmediate` (#609 #611) | ||
| - Miscellaneous doc fixes (#542 #596 #615 #628 #631 #690 #729) | ||
| - Use single noop function internally (#546) | ||
| - Optimize internal `_each`, `_map` and `_keys` functions. |
+6
-4
| { | ||
| "name": "async", | ||
| "description": "Higher-order functions and common patterns for asynchronous code", | ||
| "version": "0.9.2", | ||
| "version": "1.0.0", | ||
| "main": "lib/async.js", | ||
@@ -18,6 +18,8 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "benchmark": "~1.0.0", | ||
| "jshint": "~2.7.0", | ||
| "lodash": ">=2.4.1", | ||
| "mkdirp": "~0.5.1", | ||
| "nodeunit": ">0.0.0", | ||
| "uglify-js": "1.2.x", | ||
| "nodelint": ">0.0.0", | ||
| "lodash": ">=2.4.1" | ||
| "uglify-js": "1.2.x" | ||
| }, | ||
@@ -24,0 +26,0 @@ "moduleType": [ |
+2
-1
| { | ||
| "name": "async", | ||
| "description": "Higher-order functions and common patterns for asynchronous code", | ||
| "version": "0.9.2", | ||
| "version": "1.0.0", | ||
| "keywords": [ | ||
@@ -12,2 +12,3 @@ "async", | ||
| "license": "MIT", | ||
| "main": "lib/async.js", | ||
| "repository": "caolan/async", | ||
@@ -14,0 +15,0 @@ "scripts": [ |
+235
-75
@@ -8,7 +8,6 @@ /*! | ||
| */ | ||
| /*jshint onevar: false, indent:4 */ | ||
| /*global setImmediate: false, setTimeout: false, console: false */ | ||
| (function () { | ||
| var async = {}; | ||
| var noop = function () {}; | ||
@@ -18,3 +17,12 @@ // global on the server, window in the browser | ||
| root = this; | ||
| if (typeof window == 'object' && this === window) { | ||
| root = window; | ||
| } | ||
| else if (typeof global == 'object' && this === global) { | ||
| root = global; | ||
| } | ||
| else { | ||
| root = this; | ||
| } | ||
| if (root != null) { | ||
@@ -35,3 +43,3 @@ previous_async = root.async; | ||
| fn.apply(root, arguments); | ||
| } | ||
| }; | ||
| } | ||
@@ -48,22 +56,22 @@ | ||
| var _each = function (arr, iterator) { | ||
| for (var i = 0; i < arr.length; i += 1) { | ||
| iterator(arr[i], i, arr); | ||
| } | ||
| var index = -1, | ||
| length = arr.length; | ||
| while (++index < length) { | ||
| iterator(arr[index], index, arr); | ||
| } | ||
| }; | ||
| var _map = function (arr, iterator) { | ||
| if (arr.map) { | ||
| return arr.map(iterator); | ||
| } | ||
| var results = []; | ||
| _each(arr, function (x, i, a) { | ||
| results.push(iterator(x, i, a)); | ||
| }); | ||
| return results; | ||
| var index = -1, | ||
| length = arr.length, | ||
| result = Array(length); | ||
| while (++index < length) { | ||
| result[index] = iterator(arr[index], index, arr); | ||
| } | ||
| return result; | ||
| }; | ||
| var _reduce = function (arr, iterator, memo) { | ||
| if (arr.reduce) { | ||
| return arr.reduce(iterator, memo); | ||
| } | ||
| _each(arr, function (x, i, a) { | ||
@@ -75,6 +83,9 @@ memo = iterator(memo, x, i, a); | ||
| var _keys = function (obj) { | ||
| if (Object.keys) { | ||
| return Object.keys(obj); | ||
| } | ||
| var _forEachOf = function (object, iterator) { | ||
| _each(_keys(object), function (key) { | ||
| iterator(object[key], key); | ||
| }); | ||
| }; | ||
| var _keys = Object.keys || function (obj) { | ||
| var keys = []; | ||
@@ -89,10 +100,34 @@ for (var k in obj) { | ||
| var _baseSlice = function (arr, start) { | ||
| start = start || 0; | ||
| var index = -1; | ||
| var length = arr.length; | ||
| if (start) { | ||
| length -= start; | ||
| length = length < 0 ? 0 : length; | ||
| } | ||
| var result = Array(length); | ||
| while (++index < length) { | ||
| result[index] = arr[index + start]; | ||
| } | ||
| return result; | ||
| }; | ||
| //// exported async module functions //// | ||
| //// nextTick implementation with browser-compatible fallback //// | ||
| // capture the global reference to guard against fakeTimer mocks | ||
| var _setImmediate; | ||
| if (typeof setImmediate === 'function') { | ||
| _setImmediate = setImmediate; | ||
| } | ||
| if (typeof process === 'undefined' || !(process.nextTick)) { | ||
| if (typeof setImmediate === 'function') { | ||
| if (_setImmediate) { | ||
| async.nextTick = function (fn) { | ||
| // not a direct alias for IE10 compatibility | ||
| setImmediate(fn); | ||
| _setImmediate(fn); | ||
| }; | ||
@@ -110,6 +145,6 @@ async.setImmediate = async.nextTick; | ||
| async.nextTick = process.nextTick; | ||
| if (typeof setImmediate !== 'undefined') { | ||
| if (_setImmediate) { | ||
| async.setImmediate = function (fn) { | ||
| // not a direct alias for IE10 compatibility | ||
| setImmediate(fn); | ||
| _setImmediate(fn); | ||
| }; | ||
@@ -123,3 +158,3 @@ } | ||
| async.each = function (arr, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (!arr.length) { | ||
@@ -135,3 +170,3 @@ return callback(); | ||
| callback(err); | ||
| callback = function () {}; | ||
| callback = noop; | ||
| } | ||
@@ -149,3 +184,3 @@ else { | ||
| async.eachSeries = function (arr, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (!arr.length) { | ||
@@ -159,3 +194,3 @@ return callback(); | ||
| callback(err); | ||
| callback = function () {}; | ||
| callback = noop; | ||
| } | ||
@@ -177,2 +212,3 @@ else { | ||
| async.eachLimit = function (arr, limit, iterator, callback) { | ||
@@ -187,3 +223,3 @@ var fn = _eachLimit(limit); | ||
| return function (arr, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (!arr.length || limit <= 0) { | ||
@@ -207,3 +243,3 @@ return callback(); | ||
| callback(err); | ||
| callback = function () {}; | ||
| callback = noop; | ||
| } | ||
@@ -227,5 +263,114 @@ else { | ||
| async.forEachOf = async.eachOf = function (object, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| var size = object.length || _keys(object).length; | ||
| var completed = 0; | ||
| if (!size) { | ||
| return callback(); | ||
| } | ||
| _forEachOf(object, function (value, key) { | ||
| iterator(object[key], key, function (err) { | ||
| if (err) { | ||
| callback(err); | ||
| callback = function () {}; | ||
| } else { | ||
| completed += 1; | ||
| if (completed === size) { | ||
| callback(null); | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| async.forEachOfSeries = async.eachOfSeries = function (obj, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| var keys = _keys(obj); | ||
| var size = keys.length; | ||
| if (!size) { | ||
| return callback(); | ||
| } | ||
| var completed = 0; | ||
| var iterate = function () { | ||
| var sync = true; | ||
| var key = keys[completed]; | ||
| iterator(obj[key], key, function (err) { | ||
| if (err) { | ||
| callback(err); | ||
| callback = function () {}; | ||
| } | ||
| else { | ||
| completed += 1; | ||
| if (completed >= size) { | ||
| callback(null); | ||
| } | ||
| else { | ||
| if (sync) { | ||
| async.nextTick(iterate); | ||
| } | ||
| else { | ||
| iterate(); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| sync = false; | ||
| }; | ||
| iterate(); | ||
| }; | ||
| async.forEachOfLimit = async.eachOfLimit = function (obj, limit, iterator, callback) { | ||
| _forEachOfLimit(limit)(obj, iterator, callback); | ||
| }; | ||
| var _forEachOfLimit = function (limit) { | ||
| return function (obj, iterator, callback) { | ||
| callback = callback || function () {}; | ||
| var keys = _keys(obj); | ||
| var size = keys.length; | ||
| if (!size || limit <= 0) { | ||
| return callback(); | ||
| } | ||
| var completed = 0; | ||
| var started = 0; | ||
| var running = 0; | ||
| (function replenish () { | ||
| if (completed >= size) { | ||
| return callback(); | ||
| } | ||
| while (running < limit && started < size) { | ||
| started += 1; | ||
| running += 1; | ||
| var key = keys[started - 1]; | ||
| iterator(obj[key], key, function (err) { | ||
| if (err) { | ||
| callback(err); | ||
| callback = function () {}; | ||
| } | ||
| else { | ||
| completed += 1; | ||
| running -= 1; | ||
| if (completed >= size) { | ||
| callback(); | ||
| } | ||
| else { | ||
| replenish(); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| })(); | ||
| }; | ||
| }; | ||
| var doParallel = function (fn) { | ||
| return function () { | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| return fn.apply(null, [async.each].concat(args)); | ||
@@ -236,3 +381,3 @@ }; | ||
| return function () { | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| return fn.apply(null, [_eachLimit(limit)].concat(args)); | ||
@@ -243,3 +388,3 @@ }; | ||
| return function () { | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| return fn.apply(null, [async.eachSeries].concat(args)); | ||
@@ -362,3 +507,3 @@ }; | ||
| main_callback(x); | ||
| main_callback = function () {}; | ||
| main_callback = noop; | ||
| } | ||
@@ -381,3 +526,3 @@ else { | ||
| main_callback(true); | ||
| main_callback = function () {}; | ||
| main_callback = noop; | ||
| } | ||
@@ -398,3 +543,3 @@ callback(); | ||
| main_callback(false); | ||
| main_callback = function () {}; | ||
| main_callback = noop; | ||
| } | ||
@@ -437,5 +582,5 @@ callback(); | ||
| async.auto = function (tasks, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| var keys = _keys(tasks); | ||
| var remainingTasks = keys.length | ||
| var remainingTasks = keys.length; | ||
| if (!remainingTasks) { | ||
@@ -460,3 +605,3 @@ return callback(); | ||
| var taskComplete = function () { | ||
| remainingTasks-- | ||
| remainingTasks--; | ||
| _each(listeners.slice(0), function (fn) { | ||
@@ -471,3 +616,3 @@ fn(); | ||
| // prevent final callback from calling itself if it errors | ||
| callback = function () {}; | ||
| callback = noop; | ||
@@ -481,3 +626,3 @@ theCallback(null, results); | ||
| var taskCallback = function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (args.length <= 1) { | ||
@@ -494,3 +639,3 @@ args = args[0]; | ||
| // stop subsequent errors hitting callback multiple times | ||
| callback = function () {}; | ||
| callback = noop; | ||
| } | ||
@@ -503,2 +648,13 @@ else { | ||
| var requires = task.slice(0, Math.abs(task.length - 1)) || []; | ||
| // prevent dead-locks | ||
| var len = requires.length; | ||
| var dep; | ||
| while (len--) { | ||
| if (!(dep = tasks[requires[len]])) { | ||
| throw new Error('Has inexistant dependency'); | ||
| } | ||
| if (_isArray(dep) && !!~dep.indexOf(k)) { | ||
| throw new Error('Has cyclic dependencies'); | ||
| } | ||
| } | ||
| var ready = function () { | ||
@@ -550,9 +706,9 @@ return _reduce(requires, function (a, x) { | ||
| }); | ||
| } | ||
| }; | ||
| // If a callback is passed, run this as a controll flow | ||
| return callback ? wrappedTask() : wrappedTask | ||
| return callback ? wrappedTask() : wrappedTask; | ||
| }; | ||
| async.waterfall = function (tasks, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (!_isArray(tasks)) { | ||
@@ -569,6 +725,6 @@ var err = new Error('First argument to waterfall must be an array of functions'); | ||
| callback.apply(null, arguments); | ||
| callback = function () {}; | ||
| callback = noop; | ||
| } | ||
| else { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| var next = iterator.next(); | ||
@@ -591,3 +747,3 @@ if (next) { | ||
| var _parallel = function(eachfn, tasks, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (_isArray(tasks)) { | ||
@@ -597,3 +753,3 @@ eachfn.map(tasks, function (fn, callback) { | ||
| fn(function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (args.length <= 1) { | ||
@@ -611,3 +767,3 @@ args = args[0]; | ||
| tasks[k](function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (args.length <= 1) { | ||
@@ -634,3 +790,3 @@ args = args[0]; | ||
| async.series = function (tasks, callback) { | ||
| callback = callback || function () {}; | ||
| callback = callback || noop; | ||
| if (_isArray(tasks)) { | ||
@@ -640,3 +796,3 @@ async.mapSeries(tasks, function (fn, callback) { | ||
| fn(function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (args.length <= 1) { | ||
@@ -654,3 +810,3 @@ args = args[0]; | ||
| tasks[k](function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (args.length <= 1) { | ||
@@ -685,6 +841,6 @@ args = args[0]; | ||
| async.apply = function (fn) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| return function () { | ||
| return fn.apply( | ||
| null, args.concat(Array.prototype.slice.call(arguments)) | ||
| null, args.concat(_baseSlice(arguments)) | ||
| ); | ||
@@ -727,3 +883,3 @@ }; | ||
| } | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (test.apply(null, args)) { | ||
@@ -757,3 +913,3 @@ async.doWhilst(iterator, test, callback); | ||
| } | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (!test.apply(null, args)) { | ||
@@ -772,2 +928,5 @@ async.doUntil(iterator, test, callback); | ||
| } | ||
| else if(concurrency === 0) { | ||
| throw new Error('Concurrency must not be zero'); | ||
| } | ||
| function _insert(q, data, pos, callback) { | ||
@@ -780,3 +939,3 @@ if (!q.started){ | ||
| } | ||
| if(data.length == 0) { | ||
| if(data.length === 0) { | ||
| // call drain immediately if there are no tasks | ||
@@ -864,5 +1023,6 @@ return async.setImmediate(function() { | ||
| q.paused = false; | ||
| var resumeCount = Math.min(q.concurrency, q.tasks.length); | ||
| // Need to call q.process once per concurrent | ||
| // worker to preserve full concurrency after pause | ||
| for (var w = 1; w <= q.concurrency; w++) { | ||
| for (var w = 1; w <= resumeCount; w++) { | ||
| async.setImmediate(q.process); | ||
@@ -879,3 +1039,3 @@ } | ||
| return a.priority - b.priority; | ||
| }; | ||
| } | ||
@@ -903,3 +1063,3 @@ function _binarySearch(sequence, item, compare) { | ||
| } | ||
| if(data.length == 0) { | ||
| if(data.length === 0) { | ||
| // call drain immediately if there are no tasks | ||
@@ -977,5 +1137,5 @@ return async.setImmediate(function() { | ||
| var ts = typeof payload === 'number' | ||
| ? tasks.splice(0, payload) | ||
| : tasks.splice(0, tasks.length); | ||
| var ts = typeof payload === 'number' ? | ||
| tasks.splice(0, payload) : | ||
| tasks.splice(0, tasks.length); | ||
@@ -1013,5 +1173,5 @@ var ds = _map(ts, function (task) { | ||
| return function (fn) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| fn.apply(null, args.concat([function (err) { | ||
| var args = Array.prototype.slice.call(arguments, 1); | ||
| var args = _baseSlice(arguments, 1); | ||
| if (typeof console !== 'undefined') { | ||
@@ -1045,3 +1205,3 @@ if (err) { | ||
| var memoized = function () { | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| var callback = args.pop(); | ||
@@ -1060,3 +1220,3 @@ var key = hasher.apply(null, args); | ||
| fn.apply(null, args.concat([function () { | ||
| memo[key] = arguments; | ||
| memo[key] = _baseSlice(arguments); | ||
| var q = queues[key]; | ||
@@ -1101,3 +1261,3 @@ delete queues[key]; | ||
| var that = this; | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| var callback = args.pop(); | ||
@@ -1107,5 +1267,5 @@ async.reduce(fns, args, function (newargs, fn, cb) { | ||
| var err = arguments[0]; | ||
| var nextargs = Array.prototype.slice.call(arguments, 1); | ||
| var nextargs = _baseSlice(arguments, 1); | ||
| cb(err, nextargs); | ||
| }])) | ||
| }])); | ||
| }, | ||
@@ -1125,3 +1285,3 @@ function (err, results) { | ||
| var that = this; | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var args = _baseSlice(arguments); | ||
| var callback = args.pop(); | ||
@@ -1134,3 +1294,3 @@ return eachfn(fns, function (fn, cb) { | ||
| if (arguments.length > 2) { | ||
| var args = Array.prototype.slice.call(arguments, 2); | ||
| var args = _baseSlice(arguments, 2); | ||
| return go.apply(this, args); | ||
@@ -1137,0 +1297,0 @@ } |
+8
-5
@@ -6,3 +6,3 @@ { | ||
| "author": "Caolan McMahon", | ||
| "version": "0.9.2", | ||
| "version": "1.0.0", | ||
| "keywords": [ | ||
@@ -23,6 +23,8 @@ "async", | ||
| "devDependencies": { | ||
| "benchmark": "~1.0.0", | ||
| "jshint": "~2.7.0", | ||
| "lodash": ">=2.4.1", | ||
| "mkdirp": "~0.5.1", | ||
| "nodeunit": ">0.0.0", | ||
| "uglify-js": "1.2.x", | ||
| "nodelint": ">0.0.0", | ||
| "lodash": ">=2.4.1" | ||
| "uglify-js": "1.2.x" | ||
| }, | ||
@@ -41,3 +43,4 @@ "jam": { | ||
| "scripts": { | ||
| "test": "nodeunit test/test-async.js" | ||
| "test": "npm run-script lint && nodeunit test/test-async.js", | ||
| "lint": "jshint lib/*.js test/*.js perf/*.js" | ||
| }, | ||
@@ -44,0 +47,0 @@ "spm": { |
+79
-6
| # Async.js | ||
| [](https://travis-ci.org/caolan/async) | ||
| [](https://www.npmjs.org/package/async) | ||
@@ -91,3 +92,3 @@ | ||
| The source is available for download from | ||
| [GitHub](http://github.com/caolan/async). | ||
| [GitHub](https://github.com/caolan/async/blob/master/lib/async.js). | ||
| Alternatively, you can install using Node Package Manager (`npm`): | ||
@@ -97,2 +98,6 @@ | ||
| As well as using Bower: | ||
| bower install async | ||
| __Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed | ||
@@ -124,2 +129,5 @@ | ||
| * [`eachLimit`](#eachLimit) | ||
| * [`forEachOf`](#forEachOf) | ||
| * [`forEachOfSeries`](#forEachOfSeries) | ||
| * [`forEachOfLimit`](#forEachOfLimit) | ||
| * [`map`](#map) | ||
@@ -197,3 +205,4 @@ * [`mapSeries`](#mapSeries) | ||
| completed. If no error has occurred, the `callback` should be run without | ||
| arguments or with an explicit `null` argument. | ||
| arguments or with an explicit `null` argument. The array index is not passed | ||
| to the iterator. If you need the index, use [`forEachOf`](#forEachOf). | ||
| * `callback(err)` - A callback which is called when all `iterator` functions | ||
@@ -289,2 +298,63 @@ have finished, or an error occurs. | ||
| <a name="forEachOf" /> | ||
| <a name="eachOf" /> | ||
| ### forEachOf(obj, iterator, callback) | ||
| Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator. | ||
| __Arguments__ | ||
| * `obj` - An object or array to iterate over. | ||
| * `iterator(item, key, callback)` - A function to apply to each item in `obj`. | ||
| The `key` is the item's key, or index in the case of an array. The iterator is | ||
| passed a `callback(err)` which must be called once it has completed. If no | ||
| error has occurred, the callback should be run without arguments or with an | ||
| explicit `null` argument. | ||
| * `callback(err)` - A callback which is called when all `iterator` functions have finished, or an error occurs. | ||
| __Example__ | ||
| ```js | ||
| var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; | ||
| var configs = {}; | ||
| async.forEachOf(obj, function (value, key, callback) { | ||
| fs.readFile(__dirname + value, "utf8", function (err, data) { | ||
| if (err) return callback(err); | ||
| try { | ||
| configs[key] = JSON.parse(data); | ||
| } catch (e) { | ||
| return callback(e); | ||
| } | ||
| callback(); | ||
| }) | ||
| }, function (err) { | ||
| if (err) console.error(err.message); | ||
| // configs is now a map of JSON data | ||
| doSomethingWith(configs); | ||
| }) | ||
| ``` | ||
| --------------------------------------- | ||
| <a name="forEachOfSeries" /> | ||
| <a name="eachOfSeries" /> | ||
| ### forEachOfSeries(obj, iterator, callback) | ||
| Like [`forEachOf`](#forEachOf), except only one `iterator` is run at a time. The order of execution is not guaranteed for objects, but it will be guaranteed for arrays. | ||
| --------------------------------------- | ||
| <a name="forEachOfLimit" /> | ||
| <a name="eachOfLimit" /> | ||
| ### forEachOfLimit(obj, limit, iterator, callback) | ||
| Like [`forEachOf`](#forEachOf), except the number of `iterator`s running at a given time is controlled by `limit`. | ||
| --------------------------------------- | ||
| <a name="map" /> | ||
@@ -296,3 +366,3 @@ ### map(arr, iterator, callback) | ||
| callback for when it has finished processing. Each of these callback takes 2 arguments: | ||
| an `error`, and the transformed item from `arr`. If `iterator` passes an error to his | ||
| an `error`, and the transformed item from `arr`. If `iterator` passes an error to its | ||
| callback, the main `callback` (for the `map` function) is immediately called with the error. | ||
@@ -1057,3 +1127,3 @@ | ||
| <a name="applyEachSeries" /> | ||
| ### applyEachSeries(arr, iterator, callback) | ||
| ### applyEachSeries(arr, args..., callback) | ||
@@ -1518,3 +1588,4 @@ The same as [`applyEach`](#applyEach) only the functions are applied in series. | ||
| * `n` - The number of times to run the function. | ||
| * `callback` - The function to call `n` times. | ||
| * `iterator` - The function to call `n` times. | ||
| * `callback` - see [`map`](#map) | ||
@@ -1557,2 +1628,4 @@ __Example__ | ||
| If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function. | ||
| The cache of results is exposed as the `memo` property of the function returned | ||
@@ -1564,3 +1637,3 @@ by `memoize`. | ||
| * `fn` - The function to proxy and cache results from. | ||
| * `hasher` - Tn optional function for generating a custom hash for storing | ||
| * `hasher` - An optional function for generating a custom hash for storing | ||
| results. It has all the arguments applied to it apart from the callback, and | ||
@@ -1567,0 +1640,0 @@ must be synchronous. |
@@ -46,3 +46,3 @@ #!/usr/bin/env node | ||
| var componentInclude = ['name', 'description', 'version', 'keywords', | ||
| 'license']; | ||
| 'license', 'main']; | ||
@@ -49,0 +49,0 @@ var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
99423
8.8%10
25%1272
12.57%1
-50%1721
4.43%6
50%