9 lines
279 B
TypeScript
9 lines
279 B
TypeScript
export const strToBool = (str: string): boolean | undefined => {
|
|
str = str.toLowerCase()
|
|
if (str == "y" || str == "yes" || str == "true") {
|
|
return true
|
|
} else if (str == "n" || str == "no" || str == "false") {
|
|
return false
|
|
}
|
|
return undefined
|
|
} |