Socket
Socket
Sign inDemoInstall

dump-timer

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

7

index.js
const NULL_LOGGER = require('null-logger');
const { randomBytes } = require('crypto');
const NULL_STATS = {
timing() {},
};
module.exports = {
start(name, logger = NULL_LOGGER) {
start(name, { logger = NULL_LOGGER, stats = NULL_STATS } = {}) {
const start = new Date();

@@ -16,2 +20,3 @@ const key = `${name}_${randomBytes(64).toString('hex')}`;

const finish = (new Date() - this.start);
stats.timing(this.name, finish);

@@ -18,0 +23,0 @@ logger.trace({

2

package.json
{
"name": "dump-timer",
"version": "0.1.0",
"version": "0.1.1",
"description": "Really dump timer",

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

@@ -20,5 +20,17 @@ const { expect } = require('chai');

}
const myTimer = timer.start('test', logger);
const myTimer = timer.start('test', { logger });
myTimer.end();
});
it('calls stats', () => {
const stats = {
timing(...args) {
expect(args[0]).to.equal('test');
expect(args[1]).to.be.a('Number');
}
}
const myTimer = timer.start('test', { stats });
myTimer.end();
});
});
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