@jsweb/asyncs
Advanced tools
Comparing version 4.0.1 to 4.0.2
34
index.js
/** | ||
* @name @jsweb/asyncs | ||
* @version 4.0.1 | ||
* @version 4.0.2 | ||
* @desc Simple JS module for Promise and Fetch APIs, with some useful abstraction | ||
* @author Alex Bruno <git.alexbr@outlook.com> | ||
* @create date 2016-06-25 03:14:48 | ||
* @modify date 2020-06-13 23:21:59 | ||
* @modify date 2020-06-15 21:12:46 | ||
*/ | ||
@@ -26,3 +26,3 @@ import { serialize, form } from './jsweb-packs/unpkg/params.js'; | ||
* | ||
* @param {function} fn | ||
* @param {Function} fn | ||
* @param {arguments} args | ||
@@ -46,3 +46,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {function} fn | ||
* @param {Function} fn | ||
* @param {arguments} args | ||
@@ -112,3 +112,3 @@ * @returns {*} | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -144,2 +144,4 @@ * @returns {Promise} Promise | ||
if (/(get|head)/i.test(cfg.method)) delete cfg.body; | ||
try { | ||
@@ -162,5 +164,5 @@ const resp = await fetch(url, cfg); | ||
* | ||
* @param {string[]} urls | ||
* @param {String[]} urls | ||
* @param {RequestInit} cfg | ||
* @param {string} resp | ||
* @param {String} resp | ||
* @returns {Promise} Promise | ||
@@ -180,5 +182,5 @@ */ | ||
* | ||
* @param {string[]} urls | ||
* @param {String[]} urls | ||
* @param {RequestInit} cfg | ||
* @param {string} resp | ||
* @param {String} resp | ||
* @returns {Promise} Promise | ||
@@ -196,3 +198,3 @@ */ | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -215,3 +217,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -234,3 +236,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -253,3 +255,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -276,3 +278,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -295,3 +297,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -315,3 +317,3 @@ * @returns {Promise} Promise | ||
* | ||
* @param {string} url | ||
* @param {String} url | ||
* @param {RequestInit} cfg | ||
@@ -318,0 +320,0 @@ * @returns {Promise} Promise |
/** | ||
* @name @jsweb/params | ||
* @version 4.0.7 | ||
* @version 4.0.8 | ||
* @desc Simple JS module to parse/serialize HTTP query/params, useful for Fetch API or AJAX requests | ||
* @author Alex Bruno <git.alexbr@outlook.com> | ||
* @create date 2016-07-16 09:26:19 | ||
* @modify date 2020-06-13 19:03:02 | ||
* @modify date 2020-06-15 16:55:11 | ||
*/ | ||
@@ -1310,12 +1310,8 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
* Transform an object to HTTP query string. | ||
* Returns a string containing a query string suitable for use in a URL. | ||
* Returns a query string suitable for use in URL. | ||
* Does not include the question mark. | ||
* | ||
* @export {function} | ||
* @param {*} input | ||
* @returns {string} | ||
* @example | ||
* import { serialize } from '@jsweb/params' | ||
* | ||
* const query = serialize({ a: 1, b: 2, c: 3 }) // returns 'a=1&b=2&c=3' | ||
* @export Function | ||
* @param {Object} input | ||
* @returns {String} String | ||
*/ | ||
@@ -1352,11 +1348,7 @@ function serialize(input = {}) { | ||
/** | ||
* Transform an HTTP query string to literal object. | ||
* Transform HTTP query string to literal object. | ||
* | ||
* @export {function} | ||
* @param {string} input | ||
* @returns {object} | ||
* @example | ||
* import { parse } from '@jsweb/params' | ||
* | ||
* const obj = parse('a=1&b=2&c=3') // { a: 1, b: 2, c: 3 } | ||
* @export Function | ||
* @param {String} input | ||
* @returns {Object} Object | ||
*/ | ||
@@ -1385,10 +1377,5 @@ function parse(input = '') { | ||
* | ||
* @export {function} | ||
* @export Function | ||
* @param {*} input | ||
* @returns {*} | ||
* @example | ||
* import { form } from '@jsweb/params' | ||
* | ||
* const data1 = form('a=1&b=2&c=3') // FormData instance with fields/values | ||
* const data2 = form({ a: 1, b: 2, c: 3 }) // FormData instance with fields/values | ||
* @returns {*} * | ||
*/ | ||
@@ -1395,0 +1382,0 @@ function form(input) { |
{ | ||
"name": "@jsweb/asyncs", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Simple JS module for Promise and Fetch APIs, with some useful abstraction", | ||
@@ -8,5 +8,5 @@ "scripts": { | ||
"test:lint": "npm run lint", | ||
"test:build": "rollup -c", | ||
"test:clean": "rm -rf mochawesome-report", | ||
"test:unit": "mocha src/test.js --reporter mochawesome --reporter-options reportTitle=@jsweb/asyncs", | ||
"test:build": "rollup -c", | ||
"test:docs": "npm run docs", | ||
@@ -50,2 +50,4 @@ "major": "npm version major && npm run push", | ||
"@jsweb/packs": "^2.0.9", | ||
"@rollup/plugin-replace": "^2.3.3", | ||
"dom-parser": "^0.1.6", | ||
"husky": "^4.2.5", | ||
@@ -56,2 +58,3 @@ "jsdoc": "^3.6.4", | ||
"mochawesome": "^6.1.1", | ||
"node-fetch": "^2.6.0", | ||
"npm-run-all": "^4.1.5", | ||
@@ -58,0 +61,0 @@ "prettier": "^2.0.5", |
@@ -9,2 +9,4 @@ # @jsweb/asyncs | ||
See tests at [https://asyncs.jsweb.app](https://asyncs.jsweb.app) | ||
## New in v4.0.0 | ||
@@ -104,3 +106,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -123,5 +125,5 @@ | ||
| --- | --- | --- | | ||
| urls | <code>Array.<string></code> | | | ||
| urls | <code>Array.<String></code> | | | ||
| cfg | <code>RequestInit</code> | | | ||
| resp | <code>string</code> | <code>"response"</code> | | ||
| resp | <code>String</code> | <code>response</code> | | ||
@@ -141,5 +143,5 @@ <a name="requestRace"></a> | ||
| --- | --- | --- | | ||
| urls | <code>Array.<string></code> | | | ||
| urls | <code>Array.<String></code> | | | ||
| cfg | <code>RequestInit</code> | | | ||
| resp | <code>string</code> | <code>"response"</code> | | ||
| resp | <code>String</code> | <code>response</code> | | ||
@@ -157,3 +159,3 @@ <a name="requestJSON"></a> | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -172,3 +174,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -187,3 +189,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -202,3 +204,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -221,3 +223,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -236,3 +238,3 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -251,4 +253,4 @@ | ||
| --- | --- | | ||
| url | <code>string</code> | | ||
| url | <code>String</code> | | ||
| cfg | <code>RequestInit</code> | | ||
@@ -25,2 +25,4 @@ import { join } from 'path' | ||
See tests at [https://asyncs.jsweb.app](https://asyncs.jsweb.app) | ||
## New in v4.0.0 | ||
@@ -27,0 +29,0 @@ |
246
58276
12
1699