sequent-promises
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,8 @@ # Changelog | ||
### [0.1.1](https://github.com/Krivega/sequent-promises/compare/v0.1.0...v0.1.1) (2020-06-10) | ||
### Features | ||
- add isSuccessful, isError for last promise ([fd5b5de](https://github.com/Krivega/sequent-promises/commit/fd5b5dee934cb4582fc08685bd087ebfac19e086)) | ||
## [0.1.0](https://github.com/Krivega/sequent-promises/compare/v0.0.3...v0.1.0) (2020-06-10) | ||
@@ -7,0 +13,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>!0;exports.default=(r,s=e)=>r.reduce((e,r)=>e.then(({success:e,errors:t,results:o})=>{let n;return n=s(r)?r():Promise.reject((e=>{const r=new Error("Promise was not running");return r.basePromise=e,r.id="ERROR_NOT_RUNNING",r.name="Not running",r})(r)),n.then(r=>({errors:t,success:[...e,r],results:[...o,r]})).catch(r=>({success:e,errors:[...t,r],results:[...o,r]}))}),Promise.resolve({success:[],errors:[],results:[]})),exports.isNotRunningError=({id:e})=>"ERROR_NOT_RUNNING"===e; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const s=()=>!0;exports.default=(r,e=s)=>r.reduce((s,r)=>s.then(({success:s,errors:t,results:o})=>{let u;return u=e(r)?r():Promise.reject((s=>{const r=new Error("Promise was not running");return r.basePromise=s,r.id="ERROR_NOT_RUNNING",r.name="Not running",r})(r)),u.then(r=>({errors:t,success:[...s,r],results:[...o,r],isSuccessful:!0,isError:!1})).catch(r=>({success:s,errors:[...t,r],results:[...o,r],isSuccessful:!1,isError:!0}))}),Promise.resolve({success:[],errors:[],results:[]})),exports.isNotRunningError=({id:s})=>"ERROR_NOT_RUNNING"===s; |
{ | ||
"name": "sequent-promises", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "sequentPromises resolves Promises sequentially", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -32,3 +32,3 @@ # sequent-promises | ||
sequentPromises([promiseResolve, promiseReject, promiseResolve]).then( | ||
sequentPromises([promiseResolve, promiseReject, promiseResolve, isSuccessful, isError]).then( | ||
({ success, errors, results }) => { | ||
@@ -38,2 +38,4 @@ console.log(success); // [result, result] | ||
console.log(results); // [result, 'Not running: Promise was not running', result] | ||
console.log(isSuccessful); // true - last promise | ||
console.log(isError); // false - last promise | ||
console.log(isNotRunningError(errors[0])); //true; | ||
@@ -40,0 +42,0 @@ } |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
7379
6
65