diff options
author | Alexander Early <alexander.early@gmail.com> | 2018-09-03 01:34:45 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2018-09-03 01:34:45 -0700 |
commit | aff61235905be9767993ad84f9aca657d8af9e88 (patch) | |
tree | c1cdcc860eaa2dbae817372fe7c8e789c9fe031d /lib/internal | |
parent | 5f71f25b8e13976d2582ad6ec06c1dd6d3774829 (diff) | |
download | async-awaitable.tar.gz |
cleanup, remove noop and unused internal functionsawaitable
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/createTester.js | 2 | ||||
-rw-r--r-- | lib/internal/doLimit.js | 3 | ||||
-rw-r--r-- | lib/internal/doParallel.js | 6 | ||||
-rw-r--r-- | lib/internal/doParallelLimit.js | 6 | ||||
-rw-r--r-- | lib/internal/eachOfLimit.js | 3 | ||||
-rw-r--r-- | lib/internal/filter.js | 3 | ||||
-rw-r--r-- | lib/internal/map.js | 2 | ||||
-rw-r--r-- | lib/internal/noop.js | 1 | ||||
-rw-r--r-- | lib/internal/queue.js | 3 |
9 files changed, 4 insertions, 25 deletions
diff --git a/lib/internal/createTester.js b/lib/internal/createTester.js index 909679d..5858702 100644 --- a/lib/internal/createTester.js +++ b/lib/internal/createTester.js @@ -1,10 +1,8 @@ -import noop from './noop'; import breakLoop from './breakLoop'; import wrapAsync from './wrapAsync' export default function _createTester(check, getResult) { return (eachfn, arr, _iteratee, cb) => { - cb = cb || noop; var testPassed = false; var testResult; const iteratee = wrapAsync(_iteratee) diff --git a/lib/internal/doLimit.js b/lib/internal/doLimit.js deleted file mode 100644 index 70fb495..0000000 --- a/lib/internal/doLimit.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function doLimit(fn, limit) { - return (iterable, iteratee, cb) => fn(iterable, limit, iteratee, cb) -} diff --git a/lib/internal/doParallel.js b/lib/internal/doParallel.js deleted file mode 100644 index 2b76b68..0000000 --- a/lib/internal/doParallel.js +++ /dev/null @@ -1,6 +0,0 @@ -import eachOf from '../eachOf'; -import wrapAsync from './wrapAsync'; - -export default function doParallel(fn) { - return (obj, iteratee, cb) => fn(eachOf, obj, wrapAsync(iteratee), cb); -} diff --git a/lib/internal/doParallelLimit.js b/lib/internal/doParallelLimit.js deleted file mode 100644 index 5e2703a..0000000 --- a/lib/internal/doParallelLimit.js +++ /dev/null @@ -1,6 +0,0 @@ -import eachOfLimit from './eachOfLimit'; -import wrapAsync from './wrapAsync'; - -export default function doParallelLimit(fn) { - return (obj, limit, iteratee, cb) => fn(eachOfLimit(limit), obj, wrapAsync(iteratee), cb); -} diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index 999cbfa..ec6c8be 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -1,4 +1,3 @@ -import noop from './noop'; import once from './once'; import iterator from './iterator'; @@ -10,7 +9,7 @@ import breakLoop from './breakLoop'; export default (limit) => { return (obj, iteratee, callback) => { - callback = once(callback || noop); + callback = once(callback); if (limit <= 0) { throw new RangeError('concurrency limit cannot be less than 1') } diff --git a/lib/internal/filter.js b/lib/internal/filter.js index ab37390..15d7ae3 100644 --- a/lib/internal/filter.js +++ b/lib/internal/filter.js @@ -1,5 +1,4 @@ import isArrayLike from './isArrayLike'; -import noop from './noop'; import wrapAsync from './wrapAsync'; @@ -40,5 +39,5 @@ function filterGeneric(eachfn, coll, iteratee, callback) { export default function _filter(eachfn, coll, iteratee, callback) { var filter = isArrayLike(coll) ? filterArray : filterGeneric; - return filter(eachfn, coll, wrapAsync(iteratee), callback || noop); + return filter(eachfn, coll, wrapAsync(iteratee), callback); } diff --git a/lib/internal/map.js b/lib/internal/map.js index 3da8d9c..092f76d 100644 --- a/lib/internal/map.js +++ b/lib/internal/map.js @@ -1,8 +1,6 @@ -import noop from './noop'; import wrapAsync from './wrapAsync'; export default function _asyncMap(eachfn, arr, iteratee, callback) { - callback = callback || noop; arr = arr || []; var results = []; var counter = 0; diff --git a/lib/internal/noop.js b/lib/internal/noop.js deleted file mode 100644 index ca6a744..0000000 --- a/lib/internal/noop.js +++ /dev/null @@ -1 +0,0 @@ -export default function noop() {} diff --git a/lib/internal/queue.js b/lib/internal/queue.js index 4c1f5cc..751b562 100644 --- a/lib/internal/queue.js +++ b/lib/internal/queue.js @@ -1,9 +1,10 @@ -import noop from './noop'; import onlyOnce from './onlyOnce'; import setImmediate from './setImmediate'; import DLL from './DoublyLinkedList'; import wrapAsync from './wrapAsync'; +const noop = () => {} + export default function queue(worker, concurrency, payload) { if (concurrency == null) { concurrency = 1; |