always use template strings instead of string concatenation

This commit is contained in:
zadam
2022-12-21 15:19:05 +01:00
parent ea006993f6
commit 1b24276a4a
154 changed files with 433 additions and 437 deletions

View File

@@ -13,7 +13,7 @@ function exportSingleNote(taskContext, branch, format, res) {
}
if (format !== 'html' && format !== 'markdown') {
return [400, 'Unrecognized format ' + format];
return [400, `Unrecognized format ${format}`];
}
let payload, extension, mime;
@@ -23,7 +23,7 @@ function exportSingleNote(taskContext, branch, format, res) {
if (note.type === 'text') {
if (format === 'html') {
if (!content.toLowerCase().includes("<html")) {
content = '<html><head><meta charset="utf-8"></head><body>' + content + '</body></html>';
content = `<html><head><meta charset="utf-8"></head><body>${content}</body></html>`;
}
payload = html.prettyPrint(content, {indent_size: 2});
@@ -47,10 +47,10 @@ function exportSingleNote(taskContext, branch, format, res) {
mime = 'application/json';
}
const filename = note.title + "." + extension;
const filename = `${note.title}.${extension}`;
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
res.setHeader('Content-Type', mime + '; charset=UTF-8');
res.setHeader('Content-Type', `${mime}; charset=UTF-8`);
res.send(payload);