appolo-utils
Advanced tools
Comparing version 0.0.59 to 0.0.60
@@ -57,2 +57,16 @@ "use strict"; | ||
} | ||
static async allSettledSpread(promises) { | ||
let fulfilled = [], rejected = []; | ||
let results = await Promises.allSettled(promises); | ||
for (let i = 0; i < results.length; i++) { | ||
let item = results[i]; | ||
if (item.status == "fulfilled") { | ||
fulfilled.push(item.value); | ||
} | ||
else { | ||
rejected.push(item.reason); | ||
} | ||
} | ||
return [fulfilled, rejected]; | ||
} | ||
static some(promises, opts = {}) { | ||
@@ -59,0 +73,0 @@ return promiseSome_1.PromiseSome.some(promises, opts); |
@@ -72,2 +72,19 @@ import {Deferred} from "./deferred"; | ||
public static async allSettledSpread<T>(promises: Promise<T>[]): Promise<([T[], any[]])> { | ||
let fulfilled: T[] = [], rejected: any[] = []; | ||
let results = await Promises.allSettled(promises); | ||
for (let i = 0; i < results.length; i++) { | ||
let item = results[i]; | ||
if (item.status == "fulfilled") { | ||
fulfilled.push(item.value) | ||
} else { | ||
rejected.push(item.reason) | ||
} | ||
} | ||
return [fulfilled, rejected] | ||
} | ||
public static some<T>(promises: Promise<T>[], opts: { counter?: number } = {}): Promise<({ status: "fulfilled"; value: T; } | { status: "rejected"; reason: any; })[]> { | ||
@@ -74,0 +91,0 @@ |
@@ -17,3 +17,3 @@ { | ||
"main": "./index.js", | ||
"version": "0.0.59", | ||
"version": "0.0.60", | ||
"license": "MIT", | ||
@@ -20,0 +20,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
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
127015
2298