t or f for bool

This commit is contained in:
Mike Phares 2025-03-01 10:31:44 -07:00
parent 84589aec16
commit c693a7b93f
2 changed files with 9 additions and 0 deletions

7
.gitignore vendored
View File

@ -1,2 +1,9 @@
!input/example.csv
!input/example.json
.env
.env.defaults
.env.example
.vscode/launch.json
.vscode/settings.json
*.txt
input

View File

@ -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
) {