summaryrefslogtreecommitdiff
path: root/lib/async.js
diff options
context:
space:
mode:
authorAydar Zartdinov <zartdinov@gmail.com>2015-07-09 06:32:14 +0300
committerAydar Zartdinov <zartdinov@gmail.com>2015-07-09 06:32:14 +0300
commitec63006d767246aaf92b0bc474bf4043380dbad7 (patch)
tree810350771f2ae4e80b6a27f3b3f12dec58ae0668 /lib/async.js
parent3c2fd71e350f6a5cda22696ed7cc2022fe566128 (diff)
parent7ea45d7fc816235003d319e1ce96582a4c65d77a (diff)
downloadasync-ec63006d767246aaf92b0bc474bf4043380dbad7.tar.gz
Merge branch 'master' of https://github.com/caolan/async
Conflicts: package.json
Diffstat (limited to 'lib/async.js')
-rw-r--r--lib/async.js58
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/async.js b/lib/async.js
index 84d17aa..e756854 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -584,19 +584,19 @@
var attempts = [];
var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
+ times: DEFAULT_TIMES,
+ interval: DEFAULT_INTERVAL
};
function parseTimes(acc, t){
- if(typeof t === 'number'){
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if(typeof t === 'object'){
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof(t));
- }
+ if(typeof t === 'number'){
+ acc.times = parseInt(t, 10) || DEFAULT_TIMES;
+ } else if(typeof t === 'object'){
+ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
+ acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
+ } else {
+ throw new Error('Unsupported argument type for \'times\': ' + typeof(t));
+ }
}
var length = arguments.length;
@@ -622,11 +622,11 @@
}
function retryInterval(interval){
- return function(seriesCallback){
- setTimeout(function(){
- seriesCallback(null);
- }, interval);
- };
+ return function(seriesCallback){
+ setTimeout(function(){
+ seriesCallback(null);
+ }, interval);
+ };
}
while (opts.times) {
@@ -634,7 +634,7 @@
var finalAttempt = !(opts.times-=1);
attempts.push(retryAttempt(opts.task, finalAttempt));
if(!finalAttempt && opts.interval > 0){
- attempts.push(retryInterval(opts.interval));
+ attempts.push(retryInterval(opts.interval));
}
}
@@ -835,7 +835,7 @@
if(data.length === 0 && q.idle()) {
// call drain immediately if there are no tasks
return async.setImmediate(function() {
- q.drain();
+ q.drain();
});
}
_arrayEach(data, function(task) {
@@ -951,17 +951,17 @@
}
function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + ((end - beg + 1) >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
- }
- }
- return beg;
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + ((end - beg + 1) >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
+ }
+ }
+ return beg;
}
function _insert(q, data, priority, callback) {
@@ -1060,7 +1060,7 @@
var q = queues[key];
delete queues[key];
for (var i = 0, l = q.length; i < l; i++) {
- q[i].apply(null, args);
+ q[i].apply(null, args);
}
})]));
}