source: trip-planner-front/node_modules/async/internal/consoleFunc.js@ 6c1585f

Last change on this file since 6c1585f 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
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = consoleFunc;
7
8var _arrayEach = require('lodash/_arrayEach');
9
10var _arrayEach2 = _interopRequireDefault(_arrayEach);
11
12var _slice = require('./slice');
13
14var _slice2 = _interopRequireDefault(_slice);
15
16var _wrapAsync = require('./wrapAsync');
17
18var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19
20function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22function 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}
42module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.