Skip to content

Commit

Permalink
refactor(js): Use modern js syntax where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejsmolinski committed Mar 7, 2023
1 parent 8ea4551 commit 2da5809
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ function date() {
}

export function ddmmyyyy() {
const currentDate = date();
const [day, month, year] = date();

return currentDate[0] + "/" + currentDate[1] + "/" + currentDate[2];
return [day, month, year].join("/");
}

export function yyyymmdd() {
const currentDate = date();
const [day, month, year] = date();

return currentDate[2] + "/" + currentDate[1] + "/" + currentDate[0];
return [year, month, day].join("/");
}

export function hhmmss() {
const currentDate = date();
const [, , , hours, minutes, seconds] = date();

return currentDate[3] + ":" + currentDate[4] + ":" + currentDate[5];
return [hours, minutes, seconds].join("/");
}
2 changes: 1 addition & 1 deletion src/HTTP/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function post_(url, payload) {
const path = parsedUrl.pathname + parsedUrl.search;
const port =
parsedUrl.protocol === "https:"
? "443"
? 443
: parsedUrl.protocol === "http:"
? 80
: parsedUrl.port;
Expand Down
3 changes: 1 addition & 2 deletions src/System/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { spawnSync } from "child_process";

function run(command, args, options) {
const process = spawnSync(command, args, options || {});
let output;

if (process.status === 0) {
output = process.stdout ? process.stdout.toString().trim() : "";
const output = process.stdout ? process.stdout.toString().trim() : "";

return [true, output];
}
Expand Down

0 comments on commit 2da5809

Please sign in to comment.