From cada94ef6ec5fc2b24b97629c3f683e95ee6e13a Mon Sep 17 00:00:00 2001 From: James Ni Date: Mon, 22 Feb 2021 22:21:34 -0800 Subject: [PATCH] Minor refactor (#50) --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index c2ae52d..0fd024b 100644 --- a/index.js +++ b/index.js @@ -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))(); @@ -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 @@ -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, {