From c693a7b93f64720d15e7b04e02b7bb220bfcb73a Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Sat, 1 Mar 2025 10:31:44 -0700 Subject: [PATCH] t or f for bool --- .gitignore | 7 +++++++ utils/regex.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 08298b5..98cebe2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ +!input/example.csv +!input/example.json .env +.env.defaults +.env.example +.vscode/launch.json +.vscode/settings.json *.txt +input diff --git a/utils/regex.ts b/utils/regex.ts index a72b88e..b071923 100644 --- a/utils/regex.ts +++ b/utils/regex.ts @@ -7,6 +7,7 @@ import { RawCsvRow } from "../types/csv.ts"; * @returns */ export function isBool(data: RawCsvRow[], prop: string): boolean { + const tOrF = /^(t|f)$/; const zeroOrOne = /^(0|1)$/; const trueOrFalse = /^(true|false)$/; @@ -19,6 +20,7 @@ export function isBool(data: RawCsvRow[], prop: string): boolean { if (obj[prop] !== "") { values++; if ( + obj[prop].match(tOrF) !== null || obj[prop].match(zeroOrOne) !== null || obj[prop].match(trueOrFalse) !== null ) {