Skip to content

Commit 558c091

Browse files
committed
fix linting
1 parent f67175e commit 558c091

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

browser/main/lib/dataApi/createNoteFromUrl.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,32 @@ function validateUrl (str) {
1616

1717
function createNoteFromUrl (url, storage, folder, dispatch = null, location = null) {
1818
return new Promise((resolve, reject) => {
19-
let td = new TurndownService()
19+
const td = new TurndownService()
2020

2121
if (!validateUrl(url)) {
2222
reject({result: false, error: 'Please check your URL is in correct format. (Example, https://www.google.com)'})
2323
}
2424

25-
let request = http
26-
if (url.includes('https')) {
27-
request = https
28-
}
25+
const request = url.includes('https') ? https : http
2926

30-
let req = request.request(url, (res) => {
27+
const req = request.request(url, (res) => {
3128
let data = ''
3229

3330
res.on('data', (chunk) => {
3431
data += chunk
3532
})
3633

3734
res.on('end', () => {
38-
let html = document.createElement('html')
35+
const html = document.createElement('html')
3936
html.innerHTML = data
4037

41-
let scripts = html.getElementsByTagName('script')
38+
const scripts = html.getElementsByTagName('script')
4239
for (let i = scripts.length - 1; i >= 0; i--) {
4340
scripts[i].parentNode.removeChild(scripts[i])
4441
}
4542

46-
let body = html.getElementsByTagName('body')[0].innerHTML
47-
let markdownHTML = td.turndown(body)
43+
const body = html.getElementsByTagName('body')[0].innerHTML
44+
const markdownHTML = td.turndown(body)
4845

4946
html.innerHTML = ''
5047

0 commit comments

Comments
 (0)