diff options
author | Alexander Early <alex@npmjs.com> | 2018-06-10 21:41:45 -0700 |
---|---|---|
committer | Alexander Early <alex@npmjs.com> | 2018-06-10 21:41:45 -0700 |
commit | 9c3a2ac439bb4a50a5d510cd6d34e2882be4c5bc (patch) | |
tree | f55ad546665a83c97d1f7f4d3a17ae9ecf321186 | |
parent | d820fe595cbc562b1e23f60abe24cc340a1fa4fd (diff) | |
download | async-es6ify.tar.gz |
moar arrowses6ify
-rw-r--r-- | lib/internal/consoleFunc.js | 22 | ||||
-rw-r--r-- | lib/internal/filter.js | 13 |
2 files changed, 13 insertions, 22 deletions
diff --git a/lib/internal/consoleFunc.js b/lib/internal/consoleFunc.js index e7ef934..d2c1cb1 100644 --- a/lib/internal/consoleFunc.js +++ b/lib/internal/consoleFunc.js @@ -1,21 +1,15 @@ import wrapAsync from './wrapAsync'; export default function consoleFunc(name) { - return function (fn, ...args) { - return wrapAsync(fn)(...args, cb); - - function cb(err, ...resultArgs) { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } else if (console[name]) { - resultArgs.forEach(function (x) { - console[name](x); - }); + return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => { + if (typeof console === 'object') { + if (err) { + if (console.error) { + console.error(err); } + } else if (console[name]) { + resultArgs.forEach(x => console[name](x)); } } - }; + }) } diff --git a/lib/internal/filter.js b/lib/internal/filter.js index b410537..0961934 100644 --- a/lib/internal/filter.js +++ b/lib/internal/filter.js @@ -33,14 +33,11 @@ function filterGeneric(eachfn, coll, iteratee, callback) { callback(); } }); - }, function (err) { - if (err) { - callback(err); - } else { - callback(null, results - .sort((a, b) => a.index - b.index) - .map(v => v.value)); - } + }, err => { + if (err) return callback(err); + callback(null, results + .sort((a, b) => a.index - b.index) + .map(v => v.value)); }); } |