Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

debug-callback

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-callback - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

21

index.js
'use strict';
var _ = require('lodash');
var stringify = require('json-stringify-safe');
var canCoerce = function (arg) {
return _.isNumber(arg) || _.isString(arg) || _.isBoolean(arg) || _.isDate(arg) || _.isNull(arg) || _.isUndefined(arg);
};
var format = function (arg) {
if (canCoerce(arg)) {
return arg;
} else if (arg instanceof Buffer) {
var tostring = arg.toString();
return tostring.substr(0, 100).replace(/\n/g, '\n\t') + (tostring.length > 100 ? '\n\t...\n\n' : '');
} else {
var stringified = stringify(arg, null, 4);
return stringified.substr(0, 100).replace(/\n/g, '\n\t') + (stringified.length > 100 ? '\n\t...\n\n' : '');
}
};
module.exports = function (name) {

@@ -58,7 +41,7 @@ var debug = require('debug')(name);

var duration = (Date.now() - callbackTimes[key].time) / 1000;
debug('success (%s): ' + msg + '\t\t' + duration + ' seconds\n', format(res));
debug('success (%o): %s\t\t%d seconds\n', res, msg, duration);
};
var fail = function (err) {
var duration = (Date.now() - callbackTimes[key].time) / 1000;
debug('failure (%s): ' + msg + '\t\t' + duration.toString() + ' seconds\n', format(err));
debug('failure (%o): %s\t\t%d seconds\n', err, msg, duration);
};

@@ -65,0 +48,0 @@ var fin = function () {

2

package.json
{
"name": "debug-callback",
"version": "0.0.3",
"version": "0.0.4",
"description": "Debug output outstanding callbacks, results, errors, and call times.",

@@ -5,0 +5,0 @@ "repository": {

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