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

@sinonjs/fake-timers

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinonjs/fake-timers - npm Package Compare versions

Comparing version 11.0.0 to 11.1.0

2

package.json
{
"name": "@sinonjs/fake-timers",
"description": "Fake JavaScript timers",
"version": "11.0.0",
"version": "11.1.0",
"homepage": "https://github.com/sinonjs/fake-timers",

@@ -6,0 +6,0 @@ "author": "Christian Johansen",

@@ -146,4 +146,2 @@ "use strict";

function withGlobal(_global) {
const userAgent = _global.navigator && _global.navigator.userAgent;
const isRunningInIE = userAgent && userAgent.indexOf("MSIE ") > -1;
const maxTimeout = Math.pow(2, 31) - 1; //see https://heycam.github.io/webidl/#abstract-opdef-converttoint

@@ -190,25 +188,8 @@ const idCounterStart = 1e12; // arbitrarily large number to avoid collisions with native timer IDs

_global.setImmediate && typeof _global.setImmediate === "function";
const intlPresent = _global.Intl && typeof _global.Intl === "object";
// Make properties writable in IE, as per
// https://www.adequatelygood.com/Replacing-setTimeout-Globally.html
/* eslint-disable no-self-assign */
if (isRunningInIE) {
_global.setTimeout = _global.setTimeout;
_global.clearTimeout = _global.clearTimeout;
_global.setInterval = _global.setInterval;
_global.clearInterval = _global.clearInterval;
_global.Date = _global.Date;
}
// setImmediate is not a standard function
// avoid adding the prop to the window object if not present
if (setImmediatePresent) {
_global.setImmediate = _global.setImmediate;
_global.clearImmediate = _global.clearImmediate;
}
/* eslint-enable no-self-assign */
_global.clearTimeout(timeoutResult);
const NativeDate = _global.Date;
const NativeIntl = _global.Intl;
let uniqueTimerId = idCounterStart;

@@ -506,2 +487,36 @@

//eslint-disable-next-line jsdoc/require-jsdoc
function createIntl() {
const ClockIntl = { ...NativeIntl };
ClockIntl.DateTimeFormat = function (...args) {
const realFormatter = new NativeIntl.DateTimeFormat(...args);
const formatter = {};
["formatRange", "formatRangeToParts", "resolvedOptions"].forEach(
(method) => {
formatter[method] =
realFormatter[method].bind(realFormatter);
}
);
["format", "formatToParts"].forEach((method) => {
formatter[method] = function (date) {
return realFormatter[method](date || ClockIntl.clock.now);
};
});
return formatter;
};
ClockIntl.DateTimeFormat.prototype = Object.create(
NativeIntl.DateTimeFormat.prototype
);
ClockIntl.DateTimeFormat.supportedLocalesOf =
NativeIntl.DateTimeFormat.supportedLocalesOf;
return ClockIntl;
}
//eslint-disable-next-line jsdoc/require-jsdoc
function enqueueJob(clock, job) {

@@ -940,2 +955,4 @@ // enqueues a microtick-deferred task - ecma262/#sec-enqueuejob

target[method] = date;
} else if (method === "Intl") {
target[method] = clock[method];
} else if (method === "performance") {

@@ -995,2 +1012,3 @@ const originalPerfDescriptor = Object.getOwnPropertyDescriptor(

* @property {Date} Date
* @property {Intl} Intl
* @property {SetImmediate=} setImmediate

@@ -1054,2 +1072,6 @@ * @property {function(NodeImmediate): void=} clearImmediate

if (intlPresent) {
timers.Intl = _global.Intl;
}
const originalSetTimeout = _global.setImmediate || _global.setTimeout;

@@ -1133,2 +1155,7 @@

if (intlPresent) {
clock.Intl = createIntl();
clock.Intl.clock = clock;
}
clock.requestIdleCallback = function requestIdleCallback(

@@ -1735,8 +1762,8 @@ func,

const proto = (() => {
if (hasPerformanceConstructorPrototype) {
return _global.performance.constructor.prototype;
}
if (hasPerformancePrototype) {
return _global.Performance.prototype;
}
if (hasPerformanceConstructorPrototype) {
return _global.performance.constructor.prototype;
}
})();

@@ -1743,0 +1770,0 @@ if (proto) {

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