Socket
Socket
Sign inDemoInstall

diagnostics

Package Overview
Dependencies
5
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

42

index.js
'use strict';
var human = require('pretty-hrtime')
, env = require('env-variable')
var env = require('env-variable')
, Stream = require('stream')

@@ -12,11 +11,2 @@ , colorjs = require('color')

/**
* All the different name spaces that are currently using this module.
*
* @type {Array}
* @private
*/
var namespaces = []
, max;
/**
* Check if the terminal we're using allows the use of colors.

@@ -85,16 +75,5 @@ *

//
// Add the namespace an re-calculate the max-length of the namespace so we can
// have a consistent indentation.
//
namespaces.push(name);
max = Math.max.apply(Math, namespaces.map(function map(namespace) {
return namespace.toString().length;
}));
//
// The actual debug function which does the logging magic.
//
return function debug(line) {
debug.prev = debug.prev || process.hrtime();
//

@@ -107,7 +86,2 @@ // Better formatting for error instances.

//
// Add extra padding so all log messages start at the same line.
//
(new Array(max + 1 - name.length)).join(' '),
//
// Add the colorized namespace.

@@ -118,9 +92,2 @@ //

//
// Add the duration since the last call.
//
' ' + human(process.hrtime(debug.prev), {
precise: !!options.precise
}),
//
// The total time we took to execute the next debug statement.

@@ -142,7 +109,2 @@ //

});
//
// Update the previous call with the current time.
//
debug.prev = process.hrtime();
};

@@ -164,3 +126,3 @@ }

return variable.split(/[\s,]+/).every(function checks(check) {
return variable.split(/[\s,]+/).some(function checks(check) {
check = check.replace('*', '.*?');

@@ -167,0 +129,0 @@

5

package.json
{
"name": "diagnostics",
"version": "0.0.2",
"version": "0.0.3",
"description": "Tools for debugging your node.js modules and event loop",

@@ -36,9 +36,8 @@ "main": "index.js",

"dependencies": {
"color": "^0.6.0",
"color": "0.6.x",
"colornames": "0.0.x",
"env-variable": "0.0.x",
"kuler": "0.0.x",
"pretty-hrtime": "0.2.x",
"text-hex": "0.0.x"
}
}

@@ -9,2 +9,3 @@ describe('diagnostics', function () {

process.env.DEBUG = '';
process.env.DIAGNOSTICS = '';
});

@@ -55,2 +56,11 @@

assume(debug.enabled('primus')).to.be.false();
});
it('supports multiple ranges', function () {
process.env.DEBUG = 'bigpipe*,primus*';
assume(debug.enabled('bigpipe:')).to.be.true();
assume(debug.enabled('bigpipes')).to.be.true();
assume(debug.enabled('primus:')).to.be.true();
assume(debug.enabled('primush')).to.be.true();
assume(debug.enabled('unknown')).to.be.false();

@@ -57,0 +67,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc