From 00c4cc4befffd2ea859e8d560981cc26901aafd3 Mon Sep 17 00:00:00 2001 From: rumblefrog Date: Fri, 15 Nov 2019 16:24:02 -0500 Subject: [PATCH] refactor: inline multiple assignment --- lib/scraper.js | 6 ++---- src/scraper.ts | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/scraper.js b/lib/scraper.js index 819f882..f1904a2 100644 --- a/lib/scraper.js +++ b/lib/scraper.js @@ -18,8 +18,7 @@ const axios_1 = __importDefault(require("axios")); const await_to_js_1 = __importDefault(require("await-to-js")); function getVersions() { return __awaiter(this, void 0, void 0, function* () { - let res, err; - [err, res] = yield await_to_js_1.default(axios_1.default.get(constants_1.ENDPOINT)); + const [err, res] = yield await_to_js_1.default(axios_1.default.get(constants_1.ENDPOINT)); let versions = {}; if (err) { return versions; @@ -40,8 +39,7 @@ function getVersions() { exports.getVersions = getVersions; function getBuilds(endpoint, versions, major, minor) { return __awaiter(this, void 0, void 0, function* () { - let err, res; - [err, res] = yield await_to_js_1.default(axios_1.default.get(endpoint)); + const [err, res] = yield await_to_js_1.default(axios_1.default.get(endpoint)); if (err) { throw new Error(`Failed to pull builds from ${endpoint}`); } diff --git a/src/scraper.ts b/src/scraper.ts index 1c9063b..7369a77 100644 --- a/src/scraper.ts +++ b/src/scraper.ts @@ -4,9 +4,7 @@ import { default as axios } from 'axios'; import to from 'await-to-js'; export async function getVersions(): Promise { - let res, err; - - [ err, res ] = await to(axios.get(ENDPOINT)); + const [ err, res ] = await to(axios.get(ENDPOINT)); let versions: Versions = {}; @@ -39,9 +37,7 @@ export async function getVersions(): Promise { } async function getBuilds(endpoint: string, versions: Versions, major: number, minor: number) { - let err, res; - - [ err, res ] = await to(axios.get(endpoint)); + const [ err, res ] = await to(axios.get(endpoint)); if (err) { throw new Error(`Failed to pull builds from ${endpoint}`);