Spaces:
Paused
Paused
Download src/utils/validators/getValidBoolean.mts from jbilcke-hf/VideoChain-API: direct link, hf CLI and curl.
- Browser
- Download file 280 Bytes
-
https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/resolve/cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidBoolean.mts
- Command line
-
hf download hf://spaces/jbilcke-hf/VideoChain-API@cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidBoolean.mts
-
curl -L -o getValidBoolean.mts https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/resolve/cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidBoolean.mts
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" | |
| } |