crypto-news-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -60,12 +60,10 @@ "use strict"; | ||
if (query === void 0) { query = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var queryString; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
queryString = qs.stringify(__assign({}, query, { key: this.apikey })); | ||
return [4 /*yield*/, node_fetch_1.default("" + API_HOST + url + "?" + queryString)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
var queryString = qs.stringify(__assign({}, query, { key: this.apikey })); | ||
return node_fetch_1.default("" + API_HOST + url + "?" + queryString) | ||
.then(function (response) { | ||
if (response.status === 401) | ||
throw new Error('Invalid API Key'); | ||
if (response.status !== 200) | ||
throw new Error('Bad response from the CryptoControl server'); | ||
return response.json(); | ||
}); | ||
@@ -72,0 +70,0 @@ }; |
10
index.ts
@@ -55,3 +55,3 @@ import fetch from 'node-fetch' | ||
private async _fetch(url: string, query: any = {}): Promise<any> { | ||
private _fetch(url: string, query: any = {}): Promise<any> { | ||
const queryString = qs.stringify({ | ||
@@ -62,3 +62,9 @@ ...query, | ||
return await fetch(`${API_HOST}${url}?${queryString}`) | ||
return fetch(`${API_HOST}${url}?${queryString}`) | ||
.then(response => { | ||
if (response.status === 401) throw new Error('Invalid API Key') | ||
if (response.status !== 200) throw new Error('Bad response from the CryptoControl server') | ||
return response.json() | ||
}) | ||
} | ||
@@ -65,0 +71,0 @@ |
{ | ||
"name": "crypto-news-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "API to get a crypto newsfeed in your app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13058
263
0