Socket
Socket
Sign inDemoInstall

@rushstack/node-core-library

Package Overview
Dependencies
Maintainers
3
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/node-core-library - npm Package Compare versions

Comparing version 3.49.0 to 3.50.0

15

lib/Async.d.ts

@@ -17,2 +17,13 @@ /**

/**
* @remarks
* Used with {@link Async.runWithRetriesAsync}.
*
* @beta
*/
export interface IRunWithRetriesOptions<TResult> {
action: () => Promise<TResult> | TResult;
maxRetries: number;
retryDelayMs?: number;
}
/**
* Utilities for parallel asynchronous operations, for use with the system `Promise` APIs.

@@ -67,3 +78,7 @@ *

static sleep(ms: number): Promise<void>;
/**
* Executes an async function and optionally retries it if it fails.
*/
static runWithRetriesAsync<TResult>({ action, maxRetries, retryDelayMs }: IRunWithRetriesOptions<TResult>): Promise<TResult>;
}
//# sourceMappingURL=Async.d.ts.map

@@ -119,4 +119,24 @@ "use strict";

}
/**
* Executes an async function and optionally retries it if it fails.
*/
static async runWithRetriesAsync({ action, maxRetries, retryDelayMs = 0 }) {
let retryCounter = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
try {
return await action();
}
catch (e) {
if (++retryCounter > maxRetries) {
throw e;
}
else if (retryDelayMs > 0) {
await Async.sleep(retryDelayMs);
}
}
}
}
}
exports.Async = Async;
//# sourceMappingURL=Async.js.map

2

lib/index.d.ts

@@ -8,3 +8,3 @@ /**

export { AnsiEscape, IAnsiEscapeConvertForTestsOptions } from './Terminal/AnsiEscape';
export { Async, IAsyncParallelismOptions } from './Async';
export { Async, IAsyncParallelismOptions, IRunWithRetriesOptions } from './Async';
export { Brand } from './PrimitiveTypes';

@@ -11,0 +11,0 @@ export { FileConstants, FolderConstants } from './Constants';

{
"name": "@rushstack/node-core-library",
"version": "3.49.0",
"version": "3.50.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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