Skip to content

Commit

Permalink
🐛 Change ?. to || ""
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 13, 2020
1 parent 6875979 commit 1a302b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ export const generateSummary = async () => {
let startTime = new Date().toISOString();
try {
startTime =
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- starttime"))
?.split("startTime:")[1]
(
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- starttime")) || ""
)
.split("startTime:")[1]
.trim() || new Date().toISOString();
} catch (error) {}
let secondsDown = 0;
Expand Down
20 changes: 12 additions & 8 deletions src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ export const update = async () => {

try {
currentStatus =
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- status"))
?.split(":")[1]
(
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- status")) || ""
)
.split(":")[1]
.trim() || "unknown";
startTime =
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- starttime"))
?.split("startTime:")[1]
(
(await readFile(join(".", "history", `${slug}.yml`), "utf8"))
.split("\n")
.find((line) => line.toLocaleLowerCase().includes("- starttime")) || ""
)
.split("startTime:")[1]
.trim() || new Date().toISOString();
} catch (error) {}

Expand Down

0 comments on commit 1a302b1

Please sign in to comment.