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

@takeshape/util

Package Overview
Dependencies
Maintainers
4
Versions
760
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@takeshape/util - npm Package Compare versions

Comparing version 5.54.1 to 6.8.0

20

es/delay.js
export const delay = (timeout, value) => new Promise(resolve => {
setTimeout(resolve, timeout, value);
});
});
function randomInt(minimum, maximum) {
return Math.floor(Math.random() * (maximum - minimum + 1) + minimum);
} // Decorrelated jitter backoff:
// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
export async function backoff(baseDelay, maxDelay, attempt = {
num: 1,
lastDelay: 0
}) {
const msec = Math.min(maxDelay, randomInt(baseDelay, (attempt.lastDelay || baseDelay) * 3));
await delay(msec);
return {
num: attempt.num + 1,
lastDelay: msec
};
}
export declare const delay: <T>(timeout: number, value?: T | undefined) => Promise<T>;
export interface Attempt {
num: number;
lastDelay: number;
}
export declare function backoff(baseDelay: number, maxDelay: number, attempt?: Attempt): Promise<Attempt>;

@@ -6,2 +6,3 @@ "use strict";

});
exports.backoff = backoff;
exports.delay = void 0;

@@ -13,2 +14,20 @@

exports.delay = delay;
exports.delay = delay;
function randomInt(minimum, maximum) {
return Math.floor(Math.random() * (maximum - minimum + 1) + minimum);
} // Decorrelated jitter backoff:
// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
async function backoff(baseDelay, maxDelay, attempt = {
num: 1,
lastDelay: 0
}) {
const msec = Math.min(maxDelay, randomInt(baseDelay, (attempt.lastDelay || baseDelay) * 3));
await delay(msec);
return {
num: attempt.num + 1,
lastDelay: msec
};
}

2

package.json
{
"name": "@takeshape/util",
"version": "5.54.1",
"version": "6.8.0",
"homepage": "https://www.takeshape.io",

@@ -5,0 +5,0 @@ "repository": {

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