stack-promises
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,2 +5,8 @@ # Changelog | ||
### [0.0.4](https://github.com/Krivega/stack-promises/compare/v0.0.3...v0.0.4) (2020-06-10) | ||
### Bug Fixes | ||
- reject stack, if last promise rejected ([f28f628](https://github.com/Krivega/stack-promises/commit/f28f628539d00f20c36a978c380740364821891b)) | ||
### [0.0.3](https://github.com/Krivega/stack-promises/compare/v0.0.2...v0.0.3) (2020-03-31) | ||
@@ -7,0 +13,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>!0;const r=new Error("Stack is empty"),t=new Error("Promise is not actual"),s=new Error("stackPromises only works with functions that returns a Promise");exports.default=()=>{const n=[],o=[],i=({task:e,index:r})=>()=>{let t=(({task:e,index:r})=>{const t=o.find(({task:t,index:s})=>e===t&&r===s);if(t)return t.promise})({task:e,index:r});return t||(t=e(),(({task:e,promise:r,index:t})=>{o.push({task:e,promise:r,index:t})})({promise:t,task:e,index:r})),t},c=()=>((r,t=e)=>r.reduce((e,r)=>e.then(({results:e,errors:s})=>{let n;return n=t(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:s,results:[...e,r]})).catch(r=>({results:e,errors:[...s,r]}))}),Promise.resolve({results:[],errors:[]})))(n),u=()=>0===n.length?Promise.reject(r):new Promise((e,r)=>{const s=(({resolve:e,reject:r})=>({results:s,errors:o})=>{if(s.length+o.length===n.length){const r=s[s.length-1];e(r)}else r(t)})({resolve:e,reject:r});c().then(s).catch(s)});return u.add=e=>{if("function"!=typeof e)throw s;const r=n.length;return n.push(i({task:e,index:r})),u},u},exports.isEmptyStackError=e=>e===r,exports.isPromiseIsNotActualError=e=>e===t; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>!0;const s=new Error("Stack is empty"),r=new Error("Promise is not actual"),t=new Error("stackPromises only works with functions that returns a Promise");exports.default=()=>{const o=[],n=[],i=({task:e,index:s})=>()=>{let r=(({task:e,index:s})=>{const r=n.find(({task:r,index:t})=>e===r&&s===t);if(r)return r.promise})({task:e,index:s});return r||(r=e(),(({task:e,promise:s,index:r})=>{n.push({task:e,promise:s,index:r})})({promise:r,task:e,index:s})),r},c=()=>((s,r=e)=>s.reduce((e,s)=>e.then(({success:e,errors:t,results:o})=>{let n;return n=r(s)?s():Promise.reject((e=>{const s=new Error("Promise was not running");return s.basePromise=e,s.id="ERROR_NOT_RUNNING",s.name="Not running",s})(s)),n.then(s=>({errors:t,success:[...e,s],results:[...o,s],isSuccessful:!0,isError:!1})).catch(s=>({success:e,errors:[...t,s],results:[...o,s],isSuccessful:!1,isError:!0}))}),Promise.resolve({success:[],errors:[],results:[]})))(o),u=()=>0===o.length?Promise.reject(s):new Promise((e,s)=>{const t=(({resolve:e,reject:s})=>({results:t,isSuccessful:n})=>{if(t.length===o.length){const r=t[t.length-1];n?e(r):s(r)}else s(r)})({resolve:e,reject:s});c().then(t).catch(t)});return u.add=e=>{if("function"!=typeof e)throw t;const s=o.length;return o.push(i({task:e,index:s})),u},u},exports.isEmptyStackError=e=>e===s,exports.isPromiseIsNotActualError=e=>e===r; |
{ | ||
"name": "stack-promises", | ||
"version": "0.0.4", | ||
"description": "sequentPromises resolves Promises sequentially", | ||
@@ -7,7 +8,4 @@ "keywords": [ | ||
], | ||
"version": "0.0.3", | ||
"author": { | ||
"name": "Krivega Dmitriy", | ||
"email": "mr.krivega@gmail.com", | ||
"url": "https://krivega.com" | ||
"bugs": { | ||
"url": "https://github.com/Krivega/stack-promises/issues" | ||
}, | ||
@@ -18,9 +16,8 @@ "repository": { | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Krivega/stack-promises/issues" | ||
"license": "MIT", | ||
"author": { | ||
"name": "Krivega Dmitriy", | ||
"email": "mr.krivega@gmail.com", | ||
"url": "https://krivega.com" | ||
}, | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"main:src": "src/index.js", | ||
"exports": { | ||
@@ -32,2 +29,4 @@ ".": { | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"files": [ | ||
@@ -37,40 +36,41 @@ "dist/**/*", | ||
], | ||
"scripts": { | ||
"build": "NODE_ENV=production rollup --config", | ||
"format": "prettier --write \"src/**/*.js\"", | ||
"lint": "eslint src/. --ext .js", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"release": "standard-version", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"promise-delay": "^2.1.0", | ||
"sequent-promises": "^0.0.3" | ||
"sequent-promises": "^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.6", | ||
"@babel/preset-env": "^7.8.6", | ||
"@babel/core": "^7.10.2", | ||
"@babel/preset-env": "^7.10.2", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@rollup/plugin-node-resolve": "^8.0.1", | ||
"babel-eslint": "10.1.0", | ||
"babel-jest": "^25.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-jest": "^23.8.0", | ||
"babel-jest": "^26.0.1", | ||
"eslint": "^7.2.0", | ||
"eslint-config-airbnb": "^18.1.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-jest": "^23.13.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.18.3", | ||
"husky": "^4.2.3", | ||
"jest": "25.2.4", | ||
"lint-staged": "^10.0.8", | ||
"prettier": "^2.0.2", | ||
"rollup": "^2.3.1", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-terser": "^5.2.0", | ||
"standard-version": "^7.1.0" | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"eslint-plugin-react": "^7.20.0", | ||
"husky": "^4.2.5", | ||
"jest": "26.0.1", | ||
"lint-staged": "^10.2.9", | ||
"prettier": "^2.0.5", | ||
"rollup": "^2.15.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"standard-version": "^8.0.0" | ||
}, | ||
"scripts": { | ||
"lint": "eslint src/. --ext .js", | ||
"format": "prettier --write \"src/**/*.js\"", | ||
"test": "jest", | ||
"build": "NODE_ENV=production rollup --config", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"release": "standard-version" | ||
}, | ||
"main:src": "src/index.js", | ||
"standard-version": { | ||
@@ -77,0 +77,0 @@ "scripts": { |
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
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
9210
12
0
+ Addedsequent-promises@0.1.4(transitive)
- Removedsequent-promises@0.0.3(transitive)
Updatedsequent-promises@^0.1.1