Skip to content

Commit

Permalink
Minor refactor (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Limegrass authored Feb 23, 2021
1 parent e316fac commit cada94e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const pLimit = concurrency => {
}
};

const run = async (fn, resolve, ...args) => {
const run = async (fn, resolve, args) => {
activeCount++;

const result = (async () => fn(...args))();
Expand All @@ -31,8 +31,8 @@ const pLimit = concurrency => {
next();
};

const enqueue = (fn, resolve, ...args) => {
queue.enqueue(run.bind(null, fn, resolve, ...args));
const enqueue = (fn, resolve, args) => {
queue.enqueue(run.bind(null, fn, resolve, args));

(async () => {
// This function needs to wait until the next microtask before comparing
Expand All @@ -48,7 +48,7 @@ const pLimit = concurrency => {
};

const generator = (fn, ...args) => new Promise(resolve => {
enqueue(fn, resolve, ...args);
enqueue(fn, resolve, args);
});

Object.defineProperties(generator, {
Expand Down

0 comments on commit cada94e

Please sign in to comment.