Comparing version 0.1.2 to 0.1.4
@@ -0,0 +0,0 @@ function createCommonjsModule(fn, module) { |
@@ -1,13 +0,19 @@ | ||
0.1.2 / 2019-11-10 | ||
================== | ||
* Added native `abort` method. | ||
* Updated README to reflect change. | ||
## 0.1.4 / 2020-04-17 | ||
- [MISC] Updated out-of-date dependencies to their latest versions which also fixed all possible fixed security vulnerabilities. | ||
- [MISC] Updated license year. | ||
- [MISC] Changed CHANGELOG format. | ||
0.1.1 / 2019-11-09 | ||
================== | ||
* Updated all dependencies to their latest versions. | ||
* Updated README. | ||
## 0.1.3 / 2019-12-19 | ||
- [MISC] Updated dependencies to their latest versions. | ||
- [MISC] Added more badges to README. | ||
0.1.0 / 2019-10-08 | ||
================== | ||
* Initial release | ||
## 0.1.2 / 2019-11-10 | ||
- Added native `abort` method. | ||
- Updated README to reflect change. | ||
## 0.1.1 / 2019-11-09 | ||
- Updated all dependencies to their latest versions. | ||
- Updated README. | ||
## 0.1.0 / 2019-10-08 | ||
- Initial release |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "chain-xhr", | ||
"version": "0.1.2", | ||
"description": "As stated in the MDN docs, a XMLHttpRequest is the safest and most reliable way to make HTTP requests. chain-xhr aims to make making XHR requests as simple as possible through a chainable API", | ||
"version": "0.1.4", | ||
"description": "A XMLHttpRequest is the safest and most reliable way to make HTTP requests and chain-xhr aims to make making XHR requests as simple as possible through a chainable API", | ||
"main": "chain-xhr.js", | ||
@@ -40,21 +40,21 @@ "scripts": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.0", | ||
"@babel/core": "^7.7.2", | ||
"@babel/plugin-proposal-class-properties": "^7.7.0", | ||
"@babel/plugin-proposal-numeric-separator": "^7.2.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2", | ||
"@babel/plugin-transform-runtime": "^7.6.2", | ||
"@babel/preset-env": "^7.7.1", | ||
"@babel/preset-typescript": "^7.7.2", | ||
"ava": "^2.4.0", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-numeric-separator": "^7.8.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9.5", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"ava": "^3.7.0", | ||
"browser-env": "^3.3.0", | ||
"rollup": "^1.26.4", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup": "^2.6.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"typescript": "^3.7.2" | ||
"typescript": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.2" | ||
"@babel/runtime": "^7.9.2" | ||
} | ||
} |
@@ -13,8 +13,9 @@ <div align="center"> | ||
[![NPM version](https://img.shields.io/npm/v/chain-xhr.svg?style=flat)](https://www.npmjs.com/package/chain-xhr) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/robertcorponoi/chain-xhr/badge.svg)](https://snyk.io/test/github/robertcorponoi/chain-xhr) | ||
[![NPM downloads](https://img.shields.io/npm/dm/chain-xhr.svg?style=flat)](https://www.npmjs.com/package/chain-xhr) | ||
<a href="https://badge.fury.io/js/chain-xhr"><img src="https://img.shields.io/github/issues/robertcorponoi/chain-xhr.svg" alt="issues" height="18"></a> | ||
<a href="https://badge.fury.io/js/chain-xhr"><img src="https://img.shields.io/github/license/robertcorponoi/chain-xhr.svg" alt="license" height="18"></a> | ||
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/robertcorponoi) | ||
[![NPM version](https://img.shields.io/npm/v/chain-xhr.svg?style=flat)](https://www.npmjs.com/package/chain-xhr) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/robertcorponoi/chain-xhr/badge.svg)](https://snyk.io/test/github/robertcorponoi/chain-xhr) | ||
![npm](https://img.shields.io/npm/dt/chain-xhr) | ||
[![NPM downloads](https://img.shields.io/npm/dm/chain-xhr.svg?style=flat)](https://www.npmjs.com/package/chain-xhr) | ||
<a href="https://badge.fury.io/js/chain-xhr"><img src="https://img.shields.io/github/issues/robertcorponoi/chain-xhr.svg" alt="issues" height="18"></a> | ||
<a href="https://badge.fury.io/js/chain-xhr"><img src="https://img.shields.io/github/license/robertcorponoi/chain-xhr.svg" alt="license" height="18"></a> | ||
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/robertcorponoi) | ||
@@ -21,0 +22,0 @@ </div> |
@@ -10,6 +10,3 @@ 'use strict' | ||
module.exports = class ChainXHR { | ||
/** | ||
* A constant that can be used to select the requested http request method from. | ||
* | ||
/** * A constant that can be used to select the requested http request method from. * | ||
* Even if a request method is provided by hand, it will be double checked against the ones defined here to make sure that it | ||
@@ -69,7 +66,5 @@ * is a valid request method. | ||
url(url: string): ChainXHR { | ||
this._request.url = new URL(url); | ||
return this; | ||
} | ||
@@ -103,6 +98,5 @@ | ||
method(method: string): ChainXHR { | ||
const methodNormalized = method.toUpperCase(); | ||
if (!this.METHODS[methodNormalized]) throw new Error('An unsupported http request method was chosen'); | ||
if (!this.METHODS.hasOwnProperty(methodNormalized)) throw new Error('An unsupported http request method was chosen'); | ||
@@ -112,3 +106,2 @@ this._request.method = methodNormalized; | ||
return this; | ||
} | ||
@@ -133,7 +126,5 @@ | ||
withCredentials(): ChainXHR { | ||
this._request.withCredentials = true; | ||
return this; | ||
} | ||
@@ -158,7 +149,5 @@ | ||
contentType(contentType: string): ChainXHR { | ||
this._request.contentType = contentType; | ||
return this; | ||
} | ||
@@ -185,3 +174,2 @@ | ||
queryParam(key: string, value: (string | number | boolean)): ChainXHR { | ||
const valueNormalized: string = value.toString(); | ||
@@ -192,3 +180,2 @@ | ||
return this; | ||
} | ||
@@ -219,3 +206,2 @@ | ||
data(data: (Object | string)): ChainXHR { | ||
if (typeof data === 'object' && ((data instanceof FormData) === false)) data = JSON.stringify(data); | ||
@@ -226,3 +212,2 @@ | ||
return this; | ||
} | ||
@@ -236,7 +221,5 @@ | ||
json(): ChainXHR { | ||
this._request.responseType = 'json'; | ||
return this; | ||
} | ||
@@ -252,7 +235,5 @@ | ||
abort(): ChainXHR { | ||
this._XHR.abort(); | ||
return this; | ||
} | ||
@@ -279,5 +260,3 @@ | ||
async send(): Promise<any> { | ||
return new Promise((resolve, reject) => { | ||
this._request.queryParams.map(queryParam => this._request.url!.searchParams.append(queryParam.key, queryParam.value)); | ||
@@ -288,7 +267,4 @@ | ||
this._XHR.addEventListener('readystatechange', () => { | ||
if (this._XHR.readyState === 4 && this._XHR.status >= 200) resolve(this._XHR.response); | ||
else if (this._XHR.status >= 400 && this._XHR.status <= 600) reject(); | ||
}); | ||
@@ -307,7 +283,4 @@ | ||
this._XHR.send(this._request.data!); | ||
}); | ||
} | ||
}; | ||
}; |
@@ -7,5 +7,6 @@ 'use strict' | ||
export default interface Methods { | ||
[method: string]: string; | ||
}; | ||
GET: string; | ||
POST: string; | ||
PUT: string; | ||
DELETE: string; | ||
}; |
@@ -7,3 +7,2 @@ 'use strict' | ||
export default interface Request { | ||
/** | ||
@@ -43,3 +42,2 @@ * The URL that the request should be sent to. | ||
data?: any; | ||
}; | ||
}; |
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
89854
1672
326
Updated@babel/runtime@^7.9.2