blob: d2c1cb1fe38baae2811e34a0d8d380d4bd77660f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import wrapAsync from './wrapAsync';
export default function consoleFunc(name) {
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));
}
}
})
}
|