New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

derf

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

derf - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

16

lib/index.js

@@ -22,2 +22,6 @@ 'use strict';

var _round = require('lodash/round');
var _round2 = _interopRequireDefault(_round);
var _onFinished = require('on-finished');

@@ -37,3 +41,3 @@

function defaultPrinter(print, time, callArgs, retArgs) {
var displayTime = Math.floor(time / 1e5) / 10 + 'ms';
var displayTime = (0, _round2.default)(time / 1e6, 2) + 'ms';

@@ -93,5 +97,5 @@ if (retArgs[0]) {

return function perfWrappedSync() {
var start = process.hrtime();
var err = undefined;
var val = undefined;
var start = process.hrtime();

@@ -133,3 +137,2 @@ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {

var start = process.hrtime();
var ret = fn.apply(this, args);

@@ -163,3 +166,3 @@

return function perfWrapped() {
return function perfWrappedCallback() {
var _this = this;

@@ -171,4 +174,2 @@

var start = process.hrtime();
// most function have the callback last, but just in case...

@@ -181,2 +182,3 @@ var index = (0, _findLastIndex2.default)(args, function (arg) {

debug('wrapping callback at arguments[%s]', index);
var start = process.hrtime();
var cb = args[index];

@@ -242,3 +244,3 @@ args[index] = function perfWrappedCb() {

debug('%s args, is error middleware', arity);
return function perfWrappedMiddleware(err, req, res, next) {
return function perfWrappedErrorMiddleware(err, req, res, next) {
var start = process.hrtime();

@@ -245,0 +247,0 @@ var finished = false;

{
"name": "derf",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -117,2 +117,9 @@ # derf

TODO
1. Because derf wraps your function calls with it's own. There is a
performance hit when the `DEBUG` environment variable is enabled. But
you shouldn't have that enabled in production anyways.
2. Try not to miswrap Functions (e.g. don't do `derf.promise(someCallbackFunction)`).
While derf won't break your code by throwing an error, it will not be able to print
the timings of that function, it may also cause the function to run slower.
Run your code with `DEBUG=derf,your:namespace:*` to view derf's own debug statements.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc