Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 31f153a

Browse files
author
Ray Arayilakath
committed
Refactored Language Class (and lint)
1 parent f09327b commit 31f153a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/classes/Languages.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import HTMLParser from 'node-html-parser'
2-
import fetch from 'node-fetch'
3-
import atob from 'atob'
1+
import HTMLParser from 'node-html-parser';
2+
import fetch from 'node-fetch';
3+
import atob from 'atob';
44

5-
async function _fetchVariable() {
6-
let html = await fetch('https://staging.replit.com/', {
5+
async function fetchVariable() {
6+
const html = await fetch('https://staging.replit.com/', {
77
method: 'GET',
88
headers: {
99
'X-Requested-With': 'ReplAPI.it',
10-
'Referrer': 'https://staging.replit.com/'
11-
}
12-
}).then(res => res.text());
13-
14-
let root = HTMLParser.parse(html, {
10+
Referrer: 'https://staging.replit.com/',
11+
},
12+
}).then((res) => res.text());
13+
14+
const root = HTMLParser.parse(html, {
1515
lowerCaseTagName: false,
1616
comment: false,
1717
blockTextElements: {
1818
script: true,
1919
noscript: true,
2020
style: true,
21-
pre: true
22-
}
21+
pre: true,
22+
},
2323
});
24-
25-
return JSON.parse(atob(root.childNodes[1].childNodes[0].childNodes[1].childNodes[0].rawText.split("'")[1].split("'")[0]))
24+
25+
return JSON.parse(atob(root.childNodes[1].childNodes[0].childNodes[1].childNodes[0].rawText.split("'")[1].split("'")[0]));
2626
}
2727

2828
export default class Languages {
@@ -31,12 +31,12 @@ export default class Languages {
3131
}
3232

3333
async getLang() {
34-
let langs = await _fetchVariable();
34+
const langs = await fetchVariable();
3535
return langs[this.lang];
3636
}
3737

3838
async getAllLangs() {
39-
let langs = await _fetchVariable();
39+
const langs = await fetchVariable();
4040
return langs;
4141
}
42-
}
42+
}

0 commit comments

Comments
 (0)