Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = consoleFunc;
|
---|
7 |
|
---|
8 | var _arrayEach = require('lodash/_arrayEach');
|
---|
9 |
|
---|
10 | var _arrayEach2 = _interopRequireDefault(_arrayEach);
|
---|
11 |
|
---|
12 | var _slice = require('./slice');
|
---|
13 |
|
---|
14 | var _slice2 = _interopRequireDefault(_slice);
|
---|
15 |
|
---|
16 | var _wrapAsync = require('./wrapAsync');
|
---|
17 |
|
---|
18 | var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
---|
19 |
|
---|
20 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
21 |
|
---|
22 | function consoleFunc(name) {
|
---|
23 | return function (fn /*, ...args*/) {
|
---|
24 | var args = (0, _slice2.default)(arguments, 1);
|
---|
25 | args.push(function (err /*, ...args*/) {
|
---|
26 | var args = (0, _slice2.default)(arguments, 1);
|
---|
27 | if (typeof console === 'object') {
|
---|
28 | if (err) {
|
---|
29 | if (console.error) {
|
---|
30 | console.error(err);
|
---|
31 | }
|
---|
32 | } else if (console[name]) {
|
---|
33 | (0, _arrayEach2.default)(args, function (x) {
|
---|
34 | console[name](x);
|
---|
35 | });
|
---|
36 | }
|
---|
37 | }
|
---|
38 | });
|
---|
39 | (0, _wrapAsync2.default)(fn).apply(null, args);
|
---|
40 | };
|
---|
41 | }
|
---|
42 | module.exports = exports['default']; |
---|
Note:
See
TracBrowser
for help on using the repository browser.