summaryrefslogtreecommitdiff
path: root/lib/internal/consoleFunc.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/consoleFunc.js')
-rw-r--r--lib/internal/consoleFunc.js22
1 files changed, 8 insertions, 14 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));
}
}
- };
+ })
}