Skip to content

Commit

Permalink
Minor: do not return void results from arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Nov 18, 2019
1 parent 0c05d28 commit 3b0bae9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/index.js
Expand Up @@ -89,7 +89,9 @@ class DataLoader<K, V, C = K> {
if (cachedPromise) {
var cacheHits = batch.cacheHits || (batch.cacheHits = []);
return new Promise(resolve => {
cacheHits.push(() => resolve(cachedPromise));
cacheHits.push(() => {
resolve(cachedPromise);
});
});
}
}
Expand Down Expand Up @@ -233,7 +235,9 @@ var enqueuePostPromiseJob =
if (!resolvedPromise) {
resolvedPromise = Promise.resolve();
}
resolvedPromise.then(() => process.nextTick(fn));
resolvedPromise.then(() => {
process.nextTick(fn);
});
} :
setImmediate || setTimeout;

Expand Down Expand Up @@ -274,7 +278,9 @@ function getCurrentBatch<K, V>(loader: DataLoader<K, V, any>): Batch<K, V> {
loader._batch = newBatch;

// Then schedule a task to dispatch this batch of requests.
loader._batchScheduleFn(() => dispatchBatch(loader, newBatch));
loader._batchScheduleFn(() => {
dispatchBatch(loader, newBatch);
});

return newBatch;
}
Expand Down Expand Up @@ -339,7 +345,9 @@ function dispatchBatch<K, V>(
batch.callbacks[i].resolve(value);
}
}
}).catch(error => failedDispatch(loader, batch, error));
}).catch(error => {
failedDispatch(loader, batch, error);
});
}

// Private: do not cache individual loads if the entire batch dispatch fails,
Expand Down

0 comments on commit 3b0bae9

Please sign in to comment.