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.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/internal/consoleFunc.js b/lib/internal/consoleFunc.js
index 35374d7..eb2e886 100644
--- a/lib/internal/consoleFunc.js
+++ b/lib/internal/consoleFunc.js
@@ -1,22 +1,24 @@
import arrayEach from 'lodash/_arrayEach';
-import rest from './rest';
+import slice from './slice';
import wrapAsync from './wrapAsync';
export default function consoleFunc(name) {
- return rest(function (fn, args) {
- wrapAsync(fn).apply(null, args.concat(rest(function (err, args) {
+ return function (fn/*, ...args*/) {
+ var args = slice(arguments, 1);
+ args.push(function (err/*, ...args*/) {
+ var args = slice(arguments, 1);
if (typeof console === 'object') {
if (err) {
if (console.error) {
console.error(err);
}
- }
- else if (console[name]) {
+ } else if (console[name]) {
arrayEach(args, function (x) {
console[name](x);
});
}
}
- })));
- });
+ })
+ wrapAsync(fn).apply(null, args);
+ };
}