Skip to content

Commit

Permalink
refactor: inline multiple assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
rumblefrog committed Nov 15, 2019
1 parent 60d8d11 commit 00c4cc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 2 additions & 4 deletions lib/scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}`);
}
Expand Down
8 changes: 2 additions & 6 deletions src/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { default as axios } from 'axios';
import to from 'await-to-js';

export async function getVersions(): Promise<Versions> {
let res, err;

[ err, res ] = await to(axios.get(ENDPOINT));
const [ err, res ] = await to(axios.get(ENDPOINT));

let versions: Versions = {};

Expand Down Expand Up @@ -39,9 +37,7 @@ export async function getVersions(): Promise<Versions> {
}

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}`);
Expand Down

0 comments on commit 00c4cc4

Please sign in to comment.