Comparing version 1.0.5 to 1.0.6
@@ -18,12 +18,12 @@ "use strict"; | ||
const { id, limit, section } = options; | ||
const url = new URL(constants_1.BASE); | ||
url.pathname = constants_1.API_PATH; | ||
let url = constants_1.BASE; | ||
url += constants_1.API_PATH[0] === "/" ? constants_1.API_PATH.slice(1) : constants_1.API_PATH; | ||
if (id) { | ||
url.pathname += "/" + id.toString(); | ||
url += "/" + id.toString(); | ||
} | ||
else if (section) { | ||
url.pathname += "/" + section; | ||
url += "/" + section; | ||
} | ||
if (limit) { | ||
url.searchParams.set("limit", limit.toString()); | ||
url += `?limit=${limit}`; | ||
} | ||
@@ -58,3 +58,3 @@ return url; | ||
const url = buildUrl(options); | ||
const res = await cross_fetch_1.default(url.toString(), fetchOptions); | ||
const res = await cross_fetch_1.default(url, fetchOptions); | ||
// check for errors | ||
@@ -61,0 +61,0 @@ if (res.status !== 200) { |
{ | ||
"name": "stuft", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A news api.", | ||
@@ -5,0 +5,0 @@ "main": "lib/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
18732