Comparing version 13.5.4 to 13.5.5
@@ -596,11 +596,18 @@ 'use strict' | ||
const timeouts = [] | ||
const intervals = [] | ||
const immediates = [] | ||
const timeouts = new Set() | ||
const immediates = new Set() | ||
const wrapTimer = | ||
(timer, ids) => | ||
(...args) => { | ||
const id = timer(...args) | ||
ids.push(id) | ||
(callback, ...timerArgs) => { | ||
const cb = (...callbackArgs) => { | ||
try { | ||
// eslint-disable-next-line n/no-callback-literal | ||
callback(...callbackArgs) | ||
} finally { | ||
ids.delete(id) | ||
} | ||
} | ||
const id = timer(cb, ...timerArgs) | ||
ids.add(id) | ||
return id | ||
@@ -610,9 +617,7 @@ } | ||
const setTimeout = wrapTimer(timers.setTimeout, timeouts) | ||
const setInterval = wrapTimer(timers.setInterval, intervals) | ||
const setImmediate = wrapTimer(timers.setImmediate, immediates) | ||
function clearTimer(clear, ids) { | ||
while (ids.length) { | ||
clear(ids.shift()) | ||
} | ||
ids.forEach(clear) | ||
ids.clear() | ||
} | ||
@@ -622,3 +627,2 @@ | ||
clearTimer(clearTimeout, timeouts) | ||
clearTimer(clearInterval, intervals) | ||
clearTimer(clearImmediate, immediates) | ||
@@ -768,5 +772,4 @@ } | ||
setImmediate, | ||
setInterval, | ||
setTimeout, | ||
stringifyRequest, | ||
} |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "13.5.4", | ||
"version": "13.5.5", | ||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>", | ||
@@ -49,6 +49,6 @@ "repository": { | ||
"nyc": "^15.0.0", | ||
"prettier": "3.2.4", | ||
"prettier": "3.2.5", | ||
"proxyquire": "^2.1.0", | ||
"rimraf": "^3.0.0", | ||
"semantic-release": "^22.0.5", | ||
"semantic-release": "^23.0.2", | ||
"sinon": "^15.0.1", | ||
@@ -55,0 +55,0 @@ "sinon-chai": "^3.7.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186846
3615