get-promisable-result 1.0.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,6 @@ interface PromisableOptions {
5
5
  rejectMessage?: string;
6
6
  }
7
7
  declare const getPromisableResult: <T>(getResultFunction: () => T, checkResult: (result: T) => boolean, options?: PromisableOptions) => Promise<T>;
8
- export { PromisableOptions, getPromisableResult };
8
+
9
+ export { getPromisableResult };
10
+ export type { PromisableOptions };
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- var e=function(e,r,t){var o;void 0===t&&(t={});var i=t.retries,n=void 0===i?10:i,s=t.delay,a=void 0===s?10:s,v=t.shouldReject,u=void 0===v||v,c=null!==(o=t.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise((function(t,o){var i=0,s=function(){var v=e();r(v)?t(v):++i<n?setTimeout(s,a):u?o(new Error(c.replace(/\{\{\s*retries\s*\}\}/g,"".concat(n)))):t(v)};s()}))};export{e as getPromisableResult};
1
+ const e=10,r=10,t=(t,s,o={})=>{var n;const{retries:l=e,delay:c=r,shouldReject:i=!0}=o,u=null!==(n=o.rejectMessage)&&void 0!==n?n:"Could not get the result after {{ retries }} retries";return new Promise((e,r)=>{let o=0;const n=()=>{const a=t();s(a)?e(a):(o++,o<l?setTimeout(n,c):i?r(new Error(u.replace(/\{\{\s*retries\s*\}\}/g,`${l}`))):e(a))};n()})};export{t as getPromisableResult};
package/dist/index.d.ts CHANGED
@@ -5,4 +5,6 @@ interface PromisableOptions {
5
5
  rejectMessage?: string;
6
6
  }
7
7
  declare const getPromisableResult: <T>(getResultFunction: () => T, checkResult: (result: T) => boolean, options?: PromisableOptions) => Promise<T>;
8
- export { PromisableOptions, getPromisableResult };
8
+
9
+ export { getPromisableResult };
10
+ export type { PromisableOptions };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";exports.getPromisableResult=function(e,r,t){var o;void 0===t&&(t={});var s=t.retries,i=void 0===s?10:s,n=t.delay,u=void 0===n?10:n,a=t.shouldReject,c=void 0===a||a,l=null!==(o=t.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise((function(t,o){var s=0,n=function(){var a=e();r(a)?t(a):++s<i?setTimeout(n,u):c?o(new Error(l.replace(/\{\{\s*retries\s*\}\}/g,"".concat(i)))):t(a)};n()}))};
1
+ "use strict";const e=10,t=10;exports.getPromisableResult=(r,s,o={})=>{var l;const{retries:i=e,delay:n=t,shouldReject:c=!0}=o,u=null!==(l=o.rejectMessage)&&void 0!==l?l:"Could not get the result after {{ retries }} retries";return new Promise((e,t)=>{let o=0;const l=()=>{const a=r();s(a)?e(a):(o++,o<i?setTimeout(l,n):c?t(new Error(u.replace(/\{\{\s*retries\s*\}\}/g,`${i}`))):e(a))};l()})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-promisable-result",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "A very small JavaScript utility to check and retry a function a limited number of times abstracting it in a Promise",
5
5
  "keywords": [
6
6
  "promise",
@@ -49,24 +49,26 @@
49
49
  "postversion": "git push && git push --tags"
50
50
  },
51
51
  "devDependencies": {
52
- "@rollup/plugin-terser": "^0.4.4",
52
+ "@eslint/js": "^10.0.1",
53
+ "@rollup/plugin-terser": "^1.0.0",
54
+ "@rollup/plugin-typescript": "^12.3.0",
53
55
  "@types/eslint": "^9.6.1",
54
56
  "@types/jest": "^30.0.0",
55
- "@types/node": "^25.0.10",
56
- "eslint": "^9.39.2",
57
- "globals": "^17.1.0",
58
- "jest": "^30.2.0",
59
- "rollup": "4.56.0",
60
- "rollup-plugin-ts": "^3.4.5",
57
+ "@types/node": "^25.5.0",
58
+ "eslint": "^10.1.0",
59
+ "globals": "^17.4.0",
60
+ "jest": "^30.3.0",
61
+ "rollup": "4.60.0",
62
+ "rollup-plugin-dts": "^6.4.1",
63
+ "rollup-plugin-tsconfig-paths": "^1.5.2",
61
64
  "ts-jest": "^29.4.6",
62
65
  "tslib": "^2.7.0",
63
- "typescript": "^5.9.3",
64
- "typescript-eslint": "^8.53.1"
66
+ "typescript": "^6.0.2",
67
+ "typescript-eslint": "^8.57.2"
65
68
  },
66
69
  "pnpm": {
67
70
  "overrides": {
68
- "glob@>=10.3.7 <=11.0.3": ">=11.1.0",
69
- "js-yaml@<4.1.1": ">=4.1.1"
71
+ "@isaacs/brace-expansion@<=5.0.0": ">=5.0.1"
70
72
  }
71
73
  }
72
74
  }