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

exer

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exer - npm Package Compare versions

Comparing version 0.0.25 to 0.0.26

7

lib/debug.d.ts

@@ -39,2 +39,3 @@ /// <reference types="node" />

alwaysDiff: boolean;
level: DebugLevel;
}

@@ -80,3 +81,3 @@ export declare enum DebugLevel {

var coerce: (val: any) => any;
var level: DebugLevel;
var level: () => DebugLevel;
var isBellow: (ofLevel: DebugLevel) => boolean;

@@ -102,4 +103,4 @@ var setLevel: (toLevel: DebugLevel) => void;

var time: (...args: any[]) => [number, number];
var end: (...args: any[]) => void;
var timeEnd: (...args: any[]) => void;
var end: (...args: any[]) => any;
var timeEnd: (...args: any[]) => any;
var millis: (span: [number, number], offset?: number) => string;

@@ -106,0 +107,0 @@ }

@@ -234,3 +234,7 @@ "use strict";

let val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) {
// console.log(prop, val);
if (prop === 'level') {
val = val in DebugLevel ? DebugLevel[val] : DebugLevel.DEBUG;
}
else if (/^(yes|on|true|enabled)$/i.test(val)) {
val = true;

@@ -397,12 +401,16 @@ }

};
Debug.level = DebugLevel.DEBUG;
Debug.level = function level() {
return ('level' in Debug.inspectOpts)
? Debug.inspectOpts.level
: DebugLevel.DEBUG;
};
Debug.isBellow = function isBellow(ofLevel) {
return Debug.level > ofLevel;
return Debug.level() > ofLevel;
};
Debug.setLevel = function setLevel(toLevel) {
if (toLevel == null || toLevel === undefined) {
Debug.level = DebugLevel.OFF;
Debug.inspectOpts.level = DebugLevel.OFF;
}
else {
Debug.level = (DebugLevel[toLevel] || DebugLevel.INFO);
Debug.inspectOpts.level = (DebugLevel[toLevel] || DebugLevel.INFO);
}

@@ -424,23 +432,39 @@ };

Debug.log = function log(...args) {
if (Debug.isBellow(DebugLevel.INFO))
return;
Debug.useConsole() ? console.log(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.fatal = function fatal(...args) {
if (Debug.isBellow(DebugLevel.FATAL))
return;
Debug.useConsole() ? console.error(...args) : process.stderr.write(util.format.call(util, ...args) + '\n');
};
Debug.error = function error(...args) {
if (Debug.isBellow(DebugLevel.ERROR))
return;
Debug.useConsole() ? console.error(...args) : process.stderr.write(util.format.call(util, ...args) + '\n');
};
Debug.info = function info(...args) {
if (Debug.isBellow(DebugLevel.INFO))
return;
Debug.useConsole() ? console.info(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.warn = function warn(...args) {
if (Debug.isBellow(DebugLevel.WARN))
return;
Debug.useConsole() ? console.warn(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.debug = function detail(...args) {
if (Debug.isBellow(DebugLevel.DEBUG))
return;
Debug.useConsole() ? console.debug(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.trace = function trace(...args) {
if (Debug.isBellow(DebugLevel.TRACE))
return;
Debug.useConsole() ? console.info(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.time = function time(...args) {
if (Debug.isBellow(DebugLevel.INFO))
return void null;
Debug.useConsole() ? console.info(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');

@@ -450,5 +474,9 @@ return void null;

Debug.end = function end(...args) {
if (Debug.isBellow(DebugLevel.INFO))
return void null;
Debug.useConsole() ? console.info(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');
};
Debug.timeEnd = function timeEnd(...args) {
if (Debug.isBellow(DebugLevel.INFO))
return void null;
Debug.useConsole() ? console.info(...args) : process.stdout.write(util.format.call(util, ...args) + '\n');

@@ -455,0 +483,0 @@ };

{
"name": "exer",
"version": "0.0.25",
"version": "0.0.26",
"description": "Utils in TypeScript, Debug, NanoTimer ...",

@@ -5,0 +5,0 @@ "author": "kbajalc@gmail.com",

Sorry, the diff of this file is not supported yet

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