CizgiRoman / src /lib /getValidBoolean.ts
MorDizayn's picture
Upload 221 files
a9c43e2
Raw
History Blame Contribute Delete
280 Bytes
export const getValidBoolean = (something: any, defaultValue: boolean) => {
if (typeof something === "boolean") {
return something
}
const strValue = `${something || defaultValue}`.toLowerCase()
return strValue === "true" || strValue === "1" || strValue === "on"
}