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

durations

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

durations - npm Package Compare versions

Comparing version 3.3.5 to 3.4.0

54

lib/timing.js
// Generated by CoffeeScript 1.12.7
(function() {
var stopwatch, timeOperation, timeOperationAsync;
var stopwatch, timeOperationAsync, timeOperationPromised, timeOperationSync;
stopwatch = require('./stopwatch');
timeOperation = function(operation) {
timeOperationSync = function(operation) {
var watch;

@@ -16,16 +16,48 @@ watch = stopwatch["new"]().start();

var next, watch;
watch = stopwatch["new"]().start();
next = function() {
var duration;
duration = watch.stop().duration();
return callback(duration);
};
return operation(next);
watch = stopwatch["new"]();
if (typeof callback === 'function') {
next = function() {
return callback(watch.stop().duration());
};
watch.start();
operation(next);
return void 0;
} else {
return new Promise(function(resolve, reject) {
next = function(error) {
if (error != null) {
return reject(error);
} else {
return resolve(watch.stop().duration());
}
};
watch.start();
return operation(next);
});
}
};
timeOperationPromised = function(operation, callback) {
var watch;
watch = stopwatch["new"]();
if (typeof callback === 'function') {
watch.start();
operation().then(function() {
return callback(watch.stop().duration());
});
return void 0;
} else {
watch.start();
return operation().then(function() {
return watch.stop().duration();
});
}
};
module.exports = {
time: timeOperation,
timeAsync: timeOperationAsync
time: timeOperationSync,
timeAsync: timeOperationAsync,
timePromised: timeOperationPromised
};
}).call(this);

@@ -10,3 +10,3 @@ {

],
"version": "3.3.5",
"version": "3.4.0",
"author": "Joel Edwards (https://github.com/joeledwards)",

@@ -32,2 +32,3 @@ "contributors": [

"devDependencies": {
"chai": "^4.1.2",
"coffee-script": "^1.12.7",

@@ -34,0 +35,0 @@ "mocha": "^2.3.4",

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