t or f for bool
This commit is contained in:
parent
84589aec16
commit
c693a7b93f
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,2 +1,9 @@
|
||||
!input/example.csv
|
||||
!input/example.json
|
||||
.env
|
||||
.env.defaults
|
||||
.env.example
|
||||
.vscode/launch.json
|
||||
.vscode/settings.json
|
||||
*.txt
|
||||
input
|
||||
|
@ -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
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user