Comparing version 1.1.2 to 1.2.0
@@ -20,8 +20,9 @@ function createTimeout(desc, timeout, cb) { | ||
* Create a promise which will be rejected after a timeout. | ||
* @param {!Promise} promise A promise to race with | ||
* @param {!Promise<T>} promise A promise to race with | ||
* @param {number} timeout Timeout in ms after which to reject | ||
* @param {string} [desc] Description of a promise to be printed in error | ||
* @returns {!Promise} A promise with a timeout | ||
* @returns {!Promise<T>} A promise with a timeout | ||
* @template T | ||
*/ | ||
async function createPromiseWithTimeout(promise, timeout, desc) { | ||
async function createPromiseWithTimeout(promise, timeout, desc) { | ||
if (!(promise instanceof Promise)) | ||
@@ -28,0 +29,0 @@ throw new Error('Promise expected') |
@@ -0,1 +1,7 @@ | ||
## 25 November 2019 | ||
### [1.2.0](https://github.com/artdecocode/promto/compare/v1.1.2...v1.2.0) | ||
- [doc] Document the promise using `@template`. | ||
## 1 May 2019 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "promto", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Create a promise with a timeout.", | ||
@@ -42,6 +42,6 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"alamode": "^2.0.0", | ||
"documentary": "^1.26.2", | ||
"zoroaster": "^3.13.0" | ||
"alamode": "^3.2.0", | ||
"documentary": "^1.34.1", | ||
"zoroaster": "^4.1.2" | ||
} | ||
} |
# promto | ||
[![npm version](https://badge.fury.io/js/promto.svg)](https://npmjs.org/package/promto) | ||
[![npm version](https://badge.fury.io/js/promto.svg)](https://www.npmjs.com/package/promto) | ||
@@ -18,3 +18,5 @@ `promto` Wrappes A Promise In Timeout. | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/0.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/0.svg?sanitize=true"> | ||
</a></p> | ||
@@ -29,5 +31,7 @@ ## API | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/1.svg?sanitize=true"> | ||
</a></p> | ||
## `async promto(`<br/> `promise: Promise,`<br/> `timeout: number,`<br/> `description: string?,`<br/>`): Promise` | ||
## <code>async <ins>promto</ins>(</code><sub><br/> `promise: Promise,`<br/> `timeout: number,`<br/> `description: string?,`<br/></sub><code>): <i>Promise</i></code> | ||
@@ -39,2 +43,6 @@ Creates a new promise which will be rejected upon timeout (after N milliseconds). It will be resolved with the promise value or rejected with the promise error when not timed out. | ||
/** | ||
* @param {number} timeout | ||
* @param {string|Error} result | ||
*/ | ||
const makePromise = async (timeout, result) => { | ||
@@ -79,3 +87,5 @@ await new Promise((resolve) => { | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/2.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/2.svg?sanitize=true"> | ||
</a></p> | ||
@@ -88,3 +98,4 @@ ## Copyright | ||
<a href="https://artd.eco"> | ||
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" /> | ||
<img width="100" src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" | ||
alt="Art Deco"> | ||
</a> | ||
@@ -95,4 +106,4 @@ </th> | ||
<a href="https://www.technation.sucks" title="Tech Nation Visa"> | ||
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif" | ||
alt="Tech Nation Visa" /> | ||
<img width="100" src="https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg" | ||
alt="Tech Nation Visa"> | ||
</a> | ||
@@ -104,2 +115,4 @@ </th> | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/-1.svg?sanitize=true"> | ||
</a></p> |
@@ -20,6 +20,7 @@ function createTimeout(desc, timeout, cb) { | ||
* Create a promise which will be rejected after a timeout. | ||
* @param {!Promise} promise A promise to race with | ||
* @param {!Promise<T>} promise A promise to race with | ||
* @param {number} timeout Timeout in ms after which to reject | ||
* @param {string} [desc] Description of a promise to be printed in error | ||
* @returns {!Promise} A promise with a timeout | ||
* @returns {!Promise<T>} A promise with a timeout | ||
* @template T | ||
*/ | ||
@@ -26,0 +27,0 @@ export default async function createPromiseWithTimeout(promise, timeout, desc) { |
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
8283
79
111