New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sleep

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sleep - npm Package Compare versions

Comparing version 6.1.0 to 6.2.0

6

index.js

@@ -5,3 +5,3 @@ var sleep = require('./build/Release/node_sleep.node');

if (seconds < 0 || seconds % 1 != 0) {
throw new Exception('Expected number of seconds');
throw new Error('Expected number of seconds');
}

@@ -13,4 +13,4 @@ sleep.usleep(seconds * 1000000);

sleep.msleep = function(miliseconds) {
if (miliseconds < 1 || miliseconds % 1 != 0) {
throw new Exception('Expected number of miliseconds');
if (miliseconds < 0 || miliseconds % 1 != 0) {
throw new Error('Expected number of miliseconds');
}

@@ -17,0 +17,0 @@ sleep.usleep(miliseconds * 1000);

{
"name": "sleep",
"version": "6.1.0",
"version": "6.2.0",
"main": "index.js",

@@ -27,5 +27,5 @@ "description": "Add sleep() and usleep() to nodejs",

"devDependencies": {
"mocha": "^4.1.0"
"mocha": "^7.1.2"
},
"gypfile": true
}

@@ -60,2 +60,10 @@ /* globals describe, it */

it('works for zero', function () {
var sleepTime = 0;
var start = new Date();
sleep.usleep(sleepTime);
var end = new Date();
assertApproxEqual(end - start, sleepTime / 1000);
});
it('works for values larger than a second', function () {

@@ -86,2 +94,10 @@ this.timeout(4000); // necessary for mocha to not complain

it('works for zero', function () {
var sleepTime = 0;
var start = new Date();
sleep.msleep(sleepTime);
var end = new Date();
assertApproxEqual(end - start, sleepTime);
});
it('does not allow negative numbers', function () {

@@ -99,1 +115,12 @@ assert.throws(function () {

});
describe('error', function () {
it('should throw a valid error', function () {
try {
sleep.msleep(Infinity);
}
catch (e) {
assert.equal(e.message, 'Expected number of miliseconds');
}
});
});

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