@naturalcycles/js-lib
Advanced tools
Comparing version 8.7.1 to 8.8.0
@@ -0,1 +1,8 @@ | ||
# [8.8.0](https://github.com/NaturalCycles/js-lib/compare/v8.7.1...v8.8.0) (2019-10-19) | ||
### Features | ||
* pMap skipErrors option ([4121a4c](https://github.com/NaturalCycles/js-lib/commit/4121a4c)) | ||
## [8.7.1](https://github.com/NaturalCycles/js-lib/compare/v8.7.0...v8.7.1) (2019-09-20) | ||
@@ -2,0 +9,0 @@ |
@@ -55,3 +55,3 @@ /* | ||
} | ||
const { concurrency, stopOnError } = options; | ||
const { concurrency, stopOnError, skipErrors } = options; | ||
if (!(typeof concurrency === 'number' && concurrency >= 1)) { | ||
@@ -77,3 +77,3 @@ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); | ||
if (resolvingCount === 0) { | ||
if (!stopOnError && errors.length) { | ||
if (!stopOnError && !skipErrors && errors.length) { | ||
reject(new AggregatedError(errors, ret)); | ||
@@ -95,3 +95,3 @@ } | ||
}, error => { | ||
if (stopOnError) { | ||
if (stopOnError && !skipErrors) { | ||
isRejected = true; | ||
@@ -98,0 +98,0 @@ reject(error); |
@@ -14,2 +14,7 @@ export interface PMapOptions { | ||
stopOnError?: boolean; | ||
/** | ||
* If true - will ignore errors and return results from successful operations. | ||
* @default false | ||
*/ | ||
skipErrors?: boolean; | ||
} | ||
@@ -16,0 +21,0 @@ /** |
@@ -57,3 +57,3 @@ "use strict"; | ||
} | ||
const { concurrency, stopOnError } = options; | ||
const { concurrency, stopOnError, skipErrors } = options; | ||
if (!(typeof concurrency === 'number' && concurrency >= 1)) { | ||
@@ -79,3 +79,3 @@ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); | ||
if (resolvingCount === 0) { | ||
if (!stopOnError && errors.length) { | ||
if (!stopOnError && !skipErrors && errors.length) { | ||
reject(new aggregatedError_1.AggregatedError(errors, ret)); | ||
@@ -97,3 +97,3 @@ } | ||
}, error => { | ||
if (stopOnError) { | ||
if (stopOnError && !skipErrors) { | ||
isRejected = true; | ||
@@ -100,0 +100,0 @@ reject(error); |
{ | ||
"name": "@naturalcycles/js-lib", | ||
"version": "8.7.1", | ||
"version": "8.8.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "del ./dist && tsc", |
@@ -26,2 +26,8 @@ /* | ||
stopOnError?: boolean | ||
/** | ||
* If true - will ignore errors and return results from successful operations. | ||
* @default false | ||
*/ | ||
skipErrors?: boolean | ||
} | ||
@@ -81,3 +87,3 @@ | ||
const { concurrency, stopOnError } = options | ||
const { concurrency, stopOnError, skipErrors } = options | ||
@@ -111,3 +117,3 @@ if (!(typeof concurrency === 'number' && concurrency >= 1)) { | ||
if (resolvingCount === 0) { | ||
if (!stopOnError && errors.length) { | ||
if (!stopOnError && !skipErrors && errors.length) { | ||
reject(new AggregatedError(errors, ret)) | ||
@@ -133,3 +139,3 @@ } else { | ||
error => { | ||
if (stopOnError) { | ||
if (stopOnError && !skipErrors) { | ||
isRejected = true | ||
@@ -136,0 +142,0 @@ reject(error) |
Sorry, the diff of this file is not supported yet
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
359104
6937