Skip to content

Commit

Permalink
Parse fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Sep 13, 2023
1 parent ce0f061 commit 5089f4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import GenerateVideo from "./commands/GenerateVideo";
import { IEvent } from "./IEvent";
import GenerateHtml from "./commands/GenerateHtml";

const asNumber = (n) => typeof n === "number" ? n : parseInt(n, 10);
const asNumber = (n) => {
if (n === void 0 || n === null || n === "null") {
return void 0;
}
n = typeof n === "number" ? n : parseInt(n, 10);
return isNaN(n) ? void 0: n;
}

const asBoolean = (n) => typeof n === "boolean" ? n : (typeof n === "string" ? /true|yes/i.test(n) : false);

Expand Down

0 comments on commit 5089f4e

Please sign in to comment.