Skip to content

Commit a81dbd4

Browse files
committed
Reformatting to fit in 80 columns
1 parent 5bda2e6 commit a81dbd4

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

q.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ if (typeof process !== "undefined") {
8989
} else {
9090
(function () {
9191
// linked list of tasks (single, with head node)
92-
var head = {task: void 0, next: null}, tail = head,
93-
maxPendingTicks = 2, pendingTicks = 0, queuedTasks = 0, usedTicks = 0,
94-
requestTick;
92+
var head = {task: void 0, next: null};
93+
var tail = head;
94+
var maxPendingTicks = 2;
95+
var pendingTicks = 0;
96+
var queuedTasks = 0;
97+
var usedTicks = 0;
98+
var requestTick = void 0;
9599

96100
function onTick() {
97101
// In case of multiple tasks ensure at least one subsequent tick
@@ -102,7 +106,10 @@ if (typeof process !== "undefined") {
102106
// Amortize latency after thrown exceptions.
103107
usedTicks = 0;
104108
maxPendingTicks *= 4; // fast grow!
105-
var expectedTicks = queuedTasks && Math.min(queuedTasks - 1, maxPendingTicks);
109+
var expectedTicks = queuedTasks && Math.min(
110+
queuedTasks - 1,
111+
maxPendingTicks
112+
);
106113
while (pendingTicks < expectedTicks) {
107114
++pendingTicks;
108115
requestTick();
@@ -122,7 +129,10 @@ if (typeof process !== "undefined") {
122129

123130
nextTick = function (task) {
124131
tail = tail.next = {task: task, next: null};
125-
if (pendingTicks < ++queuedTasks && pendingTicks < maxPendingTicks) {
132+
if (
133+
pendingTicks < ++queuedTasks &&
134+
pendingTicks < maxPendingTicks
135+
) {
126136
++pendingTicks;
127137
requestTick();
128138
}
@@ -409,7 +419,9 @@ function defer() {
409419
// Reify the stack into a string by using the accessor; this prevents
410420
// memory leaks as per GH-111. At the same time, cut off the first line;
411421
// it's always just "[object Promise]\n", as per the `toString`.
412-
promise.stack = promise.stack.substring(promise.stack.indexOf("\n") + 1);
422+
promise.stack = promise.stack.substring(
423+
promise.stack.indexOf("\n") + 1
424+
);
413425
}
414426

415427
function become(resolvedValue) {
@@ -436,11 +448,15 @@ function defer() {
436448
};
437449
deferred.notify = function (progress) {
438450
if (pending) {
439-
array_reduce(progressListeners, function (undefined, progressListener) {
440-
nextTick(function () {
441-
progressListener(progress);
442-
});
443-
}, void 0);
451+
array_reduce(
452+
progressListeners,
453+
function (undefined, progressListener) {
454+
nextTick(function () {
455+
progressListener(progress);
456+
});
457+
},
458+
void 0
459+
);
444460
}
445461
};
446462

@@ -498,7 +514,9 @@ Q.makePromise = makePromise;
498514
function makePromise(descriptor, fallback, valueOf, exception, isException) {
499515
if (fallback === void 0) {
500516
fallback = function (op) {
501-
return reject(new Error("Promise does not support operation: " + op));
517+
return reject(new Error(
518+
"Promise does not support operation: " + op
519+
));
502520
};
503521
}
504522

0 commit comments

Comments
 (0)