Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@forwardimpact/libutil

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forwardimpact/libutil - npm Package Compare versions

Comparing version
0.1.83
to
0.1.84
+2
-2
package.json
{
"name": "@forwardimpact/libutil",
"version": "0.1.83",
"version": "0.1.84",
"description": "Cross-cutting utilities: retry, hashing, token counting, and project discovery.",

@@ -47,3 +47,3 @@ "keywords": [

"devDependencies": {
"@forwardimpact/libharness": "^0.1.5"
"@forwardimpact/libmock": "^0.1.0"
},

@@ -50,0 +50,0 @@ "engines": {

@@ -0,1 +1,3 @@

const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**

@@ -7,2 +9,3 @@ * Retry class for handling transient errors with exponential backoff

#delay;
#sleep;

@@ -14,2 +17,4 @@ /**

* @param {number} [config.delay] - Initial delay in milliseconds (default: 1000)
* @param {(ms: number) => Promise<void>} [config.sleep] - Injectable sleep
* for deterministic tests (default: real setTimeout-based wait).
*/

@@ -19,2 +24,3 @@ constructor(config = {}) {

this.#delay = config.delay ?? 1000;
this.#sleep = config.sleep ?? defaultSleep;
}

@@ -93,3 +99,3 @@

const wait = exponentialDelay + jitter;
await new Promise((resolve) => setTimeout(resolve, wait));
await this.#sleep(wait);
continue;

@@ -107,3 +113,3 @@ }

const wait = exponentialDelay + jitter;
await new Promise((resolve) => setTimeout(resolve, wait));
await this.#sleep(wait);
continue;

@@ -110,0 +116,0 @@ }