Skip to content

Commit

Permalink
Clean up space in higlights
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Aug 13, 2022
1 parent 5ba4ed0 commit b319e9b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,19 @@ class ExtractHighlightsModal extends Modal {

function transformResults(dbRows: any, includeCreatedDate: boolean, dateFormat: string) {
return dbRows.reduce((old: any, e: any) => {
let entry = e[3]
let entry = e[3];

if (entry == null) {
return old;
}

// Remove continous whitespace
entry = entry.replace(/\s+/g,' ').trim();

if (includeCreatedDate) {
const createdDate = new Date(e[4])
const formattedDate = "[[" + (moment(createdDate)).format(dateFormat) + "]]"
entry = entry + " - " + formattedDate
const createdDate = new Date(e[4]);
const formattedDate = "[[" + (moment(createdDate)).format(dateFormat) + "]]";
entry = entry + " - " + formattedDate;
}

if (old[e[1]]) {
Expand Down

0 comments on commit b319e9b

Please sign in to comment.