Socket
Socket
Sign inDemoInstall

big-time

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

big-time - npm Package Compare versions

Comparing version 1.0.2 to 1.0.4

.eslintignore

79

lib/index.js

@@ -1,43 +0,56 @@

var TIMEOUT_MAX = 2147483647; // 2^31-1
var Timeout = function (callback, delay/*,[arguments]*/) {
"use strict";
var args = [];
for (var i = 2, j = arguments.length; i < j; ++i) {
args.push(arguments[i]);
}
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
this._callback = callback;
this._delay = delay;
this.start(args);
};
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Timeout.prototype.start = function (args) {
var TIMEOUT_MAX = 2147483647; // 2^31-1
// Edit this copy instead of the original to prevent changing args
// on every tick
var _args = args.slice(0);
var max = module.exports._TIMEOUT_MAX;
var Timeout = (function () {
function Timeout(callback, delay) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (this._delay <= max) {
_args.unshift(this._callback, this._delay);
}
else {
var self = this;
var callback = function () {
_classCallCheck(this, Timeout);
self._delay -= max;
self.start(args);
};
_args.unshift(callback, max);
this._callback = callback;
this._delay = delay;
this.start(args);
}
this._timeout = setTimeout.apply(null, _args);
};
Timeout.prototype.close = function () {
_createClass(Timeout, [{
key: "start",
value: function start(args) {
// Edit this copy instead of the original to prevent changing args
// on every tick
var self = this;
var _args = args.slice(0);
var max = module.exports._TIMEOUT_MAX;
clearTimeout(this._timeout);
};
if (this._delay <= max) {
_args.unshift(this._callback, this._delay);
} else {
var callback = function callback() {
var _setTimeout = function () {
self._delay -= max;
self.start(args);
};
_args.unshift(callback, max);
}
this._timeout = setTimeout.apply(null, _args);
}
}, {
key: "close",
value: function close() {
clearTimeout(this._timeout);
}
}]);
return Timeout;
})();
var _setTimeout = function _setTimeout() {
var result = Object.create(Timeout.prototype);

@@ -48,3 +61,3 @@ Timeout.apply(result, arguments);

var _clearTimeout = function (timer) {
var _clearTimeout = function _clearTimeout(timer) {

@@ -58,2 +71,2 @@ timer.close();

_TIMEOUT_MAX: TIMEOUT_MAX
};
};
{
"name": "big-time",
"version": "1.0.2",
"version": "1.0.4",
"description": "Big time makes it possible to have a timeout that is longer than 24.8 days (2^31-1 milliseconds).",
"main": "lib/index.js",
"scripts": {
"test": "lab -m 5000 -t 100 -v -La code",
"test-cov-html": "lab -m 5000 -r html -o coverage.html -La code"
"test": "lab -T test/transformer.js -m 5000 -t 95 -v -La code",
"compile": "babel src --out-dir lib",
"prepublish": "npm run compile"
},

@@ -21,2 +22,5 @@ "repository": {

"devDependencies": {
"babel": "5.5.x",
"babel-core": "5.5.x",
"babel-eslint": "3.1.x",
"code": "1.x.x",

@@ -23,0 +27,0 @@ "lab": "5.x.x"

@@ -5,3 +5,3 @@ var Code = require('code');

var BigTime = require('../lib');
var BigTime = require('../src');

@@ -8,0 +8,0 @@ var describe = lab.describe;

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