summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Early <alex@npmjs.com>2018-06-10 21:41:45 -0700
committerAlexander Early <alex@npmjs.com>2018-06-10 21:41:45 -0700
commit9c3a2ac439bb4a50a5d510cd6d34e2882be4c5bc (patch)
treef55ad546665a83c97d1f7f4d3a17ae9ecf321186
parentd820fe595cbc562b1e23f60abe24cc340a1fa4fd (diff)
downloadasync-es6ify.tar.gz
moar arrowses6ify
-rw-r--r--lib/internal/consoleFunc.js22
-rw-r--r--lib/internal/filter.js13
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));
});
}