Comparing version 1.3.0 to 1.3.1
@@ -8,4 +8,2 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _debug = require('debug'); | ||
@@ -65,6 +63,6 @@ | ||
try { | ||
(0, _assert2.default)(typeof fn === 'function', 'Expected function for wrapped function'); | ||
(0, _assert2.default)(typeof printer === 'function', 'Expected function for printer'); | ||
(0, _assert2.default)(typeof fn === 'function', 'expected a function to wrap'); | ||
(0, _assert2.default)(typeof printer === 'function', 'expected function for printing'); | ||
} catch (e) { | ||
console.warn('derf:' + e.message); // eslint-disable-line no-console | ||
console.warn('derf ' + e.message); // eslint-disable-line no-console | ||
return fn; | ||
@@ -79,2 +77,3 @@ } | ||
} catch (e) { | ||
debug('derf printer threw an error %s', e && e.stack); | ||
/* noop */ | ||
@@ -166,4 +165,2 @@ } | ||
return function perfWrappedCallback() { | ||
var _this = this; | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
@@ -178,3 +175,3 @@ args[_key3] = arguments[_key3]; | ||
if (index >= 0) { | ||
var _ret = function () { | ||
(function () { | ||
debug('wrapping callback at arguments[%s]', index); | ||
@@ -191,14 +188,9 @@ var start = process.hrtime(); | ||
}; | ||
return { | ||
v: fn.apply(_this, args) | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
})(); | ||
} else { | ||
// no callback at all. Wow.. | ||
debug('no callback passed to wrapped callback function. not logging'); | ||
} | ||
// no callback at all. Wow.. | ||
debug('no callback passed to wrapped callback function. not logging'); | ||
return fn.apply(this, args); // TODO synchronously handle it? warn? | ||
return fn.apply(this, args); | ||
}; | ||
@@ -205,0 +197,0 @@ }); |
{ | ||
"name": "derf", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
13507
201