stack-promises
Advanced tools
Comparing version 0.0.5 to 0.0.6
export declare const isEmptyStackError: (error: Error) => boolean; | ||
export declare const promiseIsNotActualError: Error; | ||
export declare const isPromiseIsNotActualError: (error: Error) => boolean; | ||
@@ -3,0 +4,0 @@ declare const creteStackPromises: <T = any>() => { |
@@ -1,2 +0,2 @@ | ||
var e,s={};Object.defineProperty(s,"__esModule",{value:!0});const r=()=>!0;e=s.default=(e,s=r)=>e.reduce(((e,r)=>e.then((({success:e,errors:t,results:n})=>{let o;return o=s(r)?r():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})(r)),o.then((s=>({errors:t,success:[...e,s],results:[...n,s],isSuccessful:!0,isError:!1}))).catch((s=>({success:e,errors:[...t,s],results:[...n,s],isSuccessful:!1,isError:!0})))}))),Promise.resolve({success:[],errors:[],results:[]})),s.isNotRunningError=({id:e})=>"ERROR_NOT_RUNNING"===e;const t=new Error("Stack is empty"),n=e=>e===t,o=new Error("Promise is not actual"),i=e=>e===o,c=new Error("stackPromises only works with functions that returns a Promise"),u=()=>{const s=[],r=[],n=({task:e,index:s})=>()=>{let t=(({task:e,index:s})=>{const t=r.find((({task:r,index:t})=>e===r&&s===t));if(t)return t.promise})({task:e,index:s});return t||(t=e(),(({task:e,promise:s,index:t})=>{r.push({task:e,promise:s,index:t})})({promise:t,task:e,index:s})),t},i=()=>0===s.length?Promise.reject(t):new Promise(((r,t)=>{const n=(({resolve:e,reject:r})=>({results:t,isSuccessful:n})=>{if(t.length===s.length){const s=t[t.length-1];n?e(s):r(s)}else r(o)})({resolve:r,reject:t});e(s).then(n).catch(n)}));return i.add=e=>{if("function"!=typeof e)throw c;const r=s.length;return s.push(n({task:e,index:r})),i},i};export{u as default,n as isEmptyStackError,i as isPromiseIsNotActualError}; | ||
import e from"sequent-promises";const t=new Error("Stack is empty"),s=e=>e===t,r=new Error("Promise is not actual"),n=e=>e===r,o=new Error("stackPromises only works with functions that returns a Promise"),i=()=>{const s=[],n=[],i=({task:e,index:t})=>()=>{let s=(({task:e,index:t})=>{const s=n.find((({task:s,index:r})=>e===s&&t===r));if(s)return s.promise})({task:e,index:t});return s||(s=e(),(({task:e,promise:t,index:s})=>{n.push({task:e,promise:t,index:s})})({promise:s,task:e,index:t})),s},a=()=>0===s.length?Promise.reject(t):new Promise(((t,n)=>{const o=(({resolve:e,reject:t})=>({results:n,isSuccessful:o})=>{if(n.length===s.length){const s=n[n.length-1];o?e(s):t(s)}else t(r)})({resolve:t,reject:n});e(s).then(o).catch(o)}));return a.add=e=>{if("function"!=typeof e)throw o;const t=s.length;return s.push(i({task:e,index:t})),a},a};export{i as default,s as isEmptyStackError,n as isPromiseIsNotActualError,r as promiseIsNotActualError}; | ||
//# sourceMappingURL=index.es5.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPromiseIsNotActualError = exports.isEmptyStackError = void 0; | ||
exports.isPromiseIsNotActualError = exports.promiseIsNotActualError = exports.isEmptyStackError = void 0; | ||
const sequent_promises_1 = __importDefault(require("sequent-promises")); | ||
@@ -14,5 +14,5 @@ const emptyStackError = new Error('Stack is empty'); | ||
exports.isEmptyStackError = isEmptyStackError; | ||
const promiseIsNotActualError = new Error('Promise is not actual'); | ||
exports.promiseIsNotActualError = new Error('Promise is not actual'); | ||
const isPromiseIsNotActualError = (error) => { | ||
return error === promiseIsNotActualError; | ||
return error === exports.promiseIsNotActualError; | ||
}; | ||
@@ -60,3 +60,3 @@ exports.isPromiseIsNotActualError = isPromiseIsNotActualError; | ||
else { | ||
reject(promiseIsNotActualError); | ||
reject(exports.promiseIsNotActualError); | ||
} | ||
@@ -66,3 +66,3 @@ }; | ||
const runStackPromises = () => { | ||
return sequent_promises_1.default(runnersStack); | ||
return (0, sequent_promises_1.default)(runnersStack); | ||
}; | ||
@@ -69,0 +69,0 @@ const result = () => { |
@@ -1,2 +0,2 @@ | ||
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).sipConnector={})}(this,(function(e){"use strict";var s,r={};Object.defineProperty(r,"__esModule",{value:!0});const t=()=>!0;s=r.default=(e,s=t)=>e.reduce(((e,r)=>e.then((({success:e,errors:t,results:n})=>{let o;return o=s(r)?r():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})(r)),o.then((s=>({errors:t,success:[...e,s],results:[...n,s],isSuccessful:!0,isError:!1}))).catch((s=>({success:e,errors:[...t,s],results:[...n,s],isSuccessful:!1,isError:!0})))}))),Promise.resolve({success:[],errors:[],results:[]})),r.isNotRunningError=({id:e})=>"ERROR_NOT_RUNNING"===e;const n=new Error("Stack is empty"),o=new Error("Promise is not actual"),i=new Error("stackPromises only works with functions that returns a Promise");e.default=()=>{const e=[],r=[],t=({task:e,index:s})=>()=>{let t=(({task:e,index:s})=>{const t=r.find((({task:r,index:t})=>e===r&&s===t));if(t)return t.promise})({task:e,index:s});return t||(t=e(),(({task:e,promise:s,index:t})=>{r.push({task:e,promise:s,index:t})})({promise:t,task:e,index:s})),t},c=()=>0===e.length?Promise.reject(n):new Promise(((r,t)=>{const n=(({resolve:s,reject:r})=>({results:t,isSuccessful:n})=>{if(t.length===e.length){const e=t[t.length-1];n?s(e):r(e)}else r(o)})({resolve:r,reject:t});s(e).then(n).catch(n)}));return c.add=s=>{if("function"!=typeof s)throw i;const r=e.length;return e.push(t({task:s,index:r})),c},c},e.isEmptyStackError=e=>e===n,e.isPromiseIsNotActualError=e=>e===o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("sequent-promises")):"function"==typeof define&&define.amd?define(["exports","sequent-promises"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).sipConnector={},e.sequentPromisesList)}(this,(function(e,t){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=s(t);const n=new Error("Stack is empty"),o=new Error("Promise is not actual"),i=new Error("stackPromises only works with functions that returns a Promise");e.default=()=>{const e=[],t=[],s=({task:e,index:s})=>()=>{let r=(({task:e,index:s})=>{const r=t.find((({task:t,index:r})=>e===t&&s===r));if(r)return r.promise})({task:e,index:s});return r||(r=e(),(({task:e,promise:s,index:r})=>{t.push({task:e,promise:s,index:r})})({promise:r,task:e,index:s})),r},u=()=>0===e.length?Promise.reject(n):new Promise(((t,s)=>{const n=(({resolve:t,reject:s})=>({results:r,isSuccessful:n})=>{if(r.length===e.length){const e=r[r.length-1];n?t(e):s(e)}else s(o)})({resolve:t,reject:s});r.default(e).then(n).catch(n)}));return u.add=t=>{if("function"!=typeof t)throw i;const r=e.length;return e.push(s({task:t,index:r})),u},u},e.isEmptyStackError=e=>e===n,e.isPromiseIsNotActualError=e=>e===o,e.promiseIsNotActualError=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "stack-promises", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "sequentPromises resolves Promises sequentially", | ||
@@ -41,29 +41,29 @@ "keywords": [ | ||
"dependencies": { | ||
"sequent-promises": "^0.1.2" | ||
"sequent-promises": "^0.1.3" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@rollup/plugin-commonjs": "^19.0.2", | ||
"@rollup/plugin-node-resolve": "^13.0.4", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^16.4.5", | ||
"@typescript-eslint/eslint-plugin": "^4.28.5", | ||
"@typescript-eslint/parser": "^4.28.5", | ||
"eslint": "^7.31.0", | ||
"@commitlint/cli": "^14.1.0", | ||
"@commitlint/config-conventional": "^14.1.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^16.11.7", | ||
"@typescript-eslint/eslint-plugin": "^5.3.1", | ||
"@typescript-eslint/parser": "^5.3.1", | ||
"eslint": "^8.2.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-jest": "^24.4.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"husky": "^7.0.1", | ||
"jest": "27.0.6", | ||
"lint-staged": "^11.1.1", | ||
"prettier": "^2.3.2", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-jest": "^25.2.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "27.3.1", | ||
"lint-staged": "^11.2.6", | ||
"prettier": "^2.4.1", | ||
"promise-delay": "^2.1.0", | ||
"rollup": "^2.55.0", | ||
"rollup": "^2.59.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "0.30.0", | ||
"standard-version": "^9.3.1", | ||
"ts-jest": "^27.0.4", | ||
"typescript": "^4.3.5" | ||
"standard-version": "^9.3.2", | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.4.4" | ||
}, | ||
@@ -70,0 +70,0 @@ "main:src": "src/index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
24497
105
3
Updatedsequent-promises@^0.1.3