sequent-promises
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,2 +5,12 @@ # Changelog | ||
### [0.0.2](https://github.com/Krivega/sequent-promises/compare/v0.0.1...v0.0.2) (2020-02-28) | ||
### Features | ||
- add function isNotRunningError ([7d7077a](https://github.com/Krivega/sequent-promises/commit/7d7077a0adeb66606227df7f20f30eda17a47c08)) | ||
### Bug Fixes | ||
- fix create not running error ([0a466e1](https://github.com/Krivega/sequent-promises/commit/0a466e1e4c3e2d17a3e3d2ef8e0f1ab8b519758a)) | ||
### 0.0.1 (2020-02-25) |
@@ -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(({results:e,errors:t})=>{let o;return o=s(r)?r():Promise.reject({basePromise:r,id:"ERROR_CANCELED",name:"Canceled",message:"Promise was not running"}),o.then(r=>({errors:t,results:[...e,r]})).catch(r=>({results:e,errors:[...t,r]}))}),Promise.resolve({results:[],errors:[]})); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r=()=>!0;exports.default=(e,s=r)=>e.reduce((r,e)=>r.then(({results:r,errors:t})=>{let o;return o=s(e)?e():Promise.reject((r=>{const e=new Error("Promise was not running");return e.basePromise=r,e.id="ERROR_NOT_RUNNING",e.name="Not running",e})(e)),o.then(e=>({errors:t,results:[...r,e]})).catch(e=>({results:r,errors:[...t,e]}))}),Promise.resolve({results:[],errors:[]})),exports.isNotRunningError=({id:r})=>"ERROR_NOT_RUNNING"===r; |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": { | ||
@@ -39,7 +39,7 @@ "name": "Krivega Dmitriy", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/core": "^7.8.6", | ||
"@babel/preset-env": "^7.8.6", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"babel-eslint": "10.0.3", | ||
"babel-eslint": "10.1.0", | ||
"babel-jest": "^25.1.0", | ||
@@ -56,5 +56,5 @@ "eslint": "^6.8.0", | ||
"jest": "25.1.0", | ||
"lint-staged": "^10.0.7", | ||
"lint-staged": "^10.0.8", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.31.1", | ||
"rollup": "^1.32.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
@@ -61,0 +61,0 @@ "rollup-plugin-terser": "^5.2.0", |
@@ -6,3 +6,3 @@ # sequent-promises | ||
Various abstractions over promises | ||
Call promises one by one, ignoring the state (fulfilled or rejected). and returning the collected data in the tuple `{ results, errors }`. | ||
@@ -25,4 +25,17 @@ ## Install | ||
## API | ||
```js | ||
import sequentPromises, { isNotRunningError } from 'sequent-promises'; | ||
const result = 'result'; | ||
const error = new Error('error'); | ||
const promiseResolve = () => Promise.resolve(result); | ||
const promiseReject = () => Promise.reject(error); | ||
sequentPromises([promiseResolve, promiseReject, promiseResolve]).then(({ results, errors }) => { | ||
console.log(results); //[result, result] | ||
console.log(errors); //[Not running: Promise was not running] | ||
console.log(isNotRunningError(errors[0])); //true; | ||
}); | ||
``` | ||
## Run tests | ||
@@ -29,0 +42,0 @@ |
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
6266
60