summaryrefslogtreecommitdiffstats
path: root/lib/utils/batch.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-09-15 13:57:21 +0200
committerSamy Pessé <samypesse@gmail.com>2015-09-15 13:57:21 +0200
commit5a205346e3d125b1c834220ce98a206d88697811 (patch)
tree47700546d3b7a3e484975e37b1bb06e7efa88b92 /lib/utils/batch.js
parente1930046599d430a6bb378af62bce78fb9d24ff7 (diff)
downloadgitbook-5a205346e3d125b1c834220ce98a206d88697811.zip
gitbook-5a205346e3d125b1c834220ce98a206d88697811.tar.gz
gitbook-5a205346e3d125b1c834220ce98a206d88697811.tar.bz2
Jshint all files
Diffstat (limited to 'lib/utils/batch.js')
-rw-r--r--lib/utils/batch.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/utils/batch.js b/lib/utils/batch.js
index bd3b80f..9069766 100644
--- a/lib/utils/batch.js
+++ b/lib/utils/batch.js
@@ -3,12 +3,12 @@ var _ = require("lodash");
// Execute a method for all element
function execEach(items, options) {
- if (_.size(items) == 0) return Q();
+ if (_.size(items) === 0) return Q();
var concurrents = 0, d = Q.defer(), pending = [];
options = _.defaults(options || {}, {
max: 100,
- fn: function(item) {}
+ fn: function() {}
});
@@ -29,7 +29,7 @@ function execEach(items, options) {
// Next pending
var next = pending.shift();
- if (concurrents == 0 && !next) {
+ if (concurrents === 0 && !next) {
d.resolve();
} else if (next) {
startItem.apply(null, next);
@@ -38,7 +38,7 @@ function execEach(items, options) {
.fail(function(err) {
pending = [];
d.reject(err);
- })
+ });
}
_.each(items, startItem);