MCPcopy Create free account
hub / github.com/Botloader/botloader / booleanRawValue

Function booleanRawValue

frontend/src/components/GuildScriptPage.tsx:498–515  ·  view source on GitHub ↗
(rawValue: any)

Source from the content-addressed store, hash-verified

496
497const trueBooleanValues = ["true", "yes", "1"]
498function booleanRawValue(rawValue: any) {
499 if (typeof rawValue === "string") {
500 if (trueBooleanValues.includes(rawValue.toLowerCase())) {
501 return true
502 }
503 return false
504 }
505
506 if (typeof rawValue === "number") {
507 return rawValue !== 0
508 }
509
510 if (typeof rawValue === "boolean") {
511 return rawValue
512 }
513
514 return false
515}
516
517function EditOptionNumberField({ option }: { option: SettingsOption }) {
518 const inputRef = useRef<HTMLInputElement | null>(null)

Callers 1

booleanValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected