Skip to main content

Function: bool_str()

bool_str(value): unknown

Defined in: src/core/transforms.ts:49

sportsdataverse._codegen_runtime.bool_str: a truthy value becomes "true", a falsy one "false" (Python truthiness, so "false" the string is truthy).

Parameters​

value​

unknown

The resolved param value. null / undefined pass through unchanged; anything else is tested with Python truthiness (0, "", [], {} are falsy; NaN and any non-empty string are truthy).

Returns​

unknown

"true" / "false", or the nullish input.

Remarks​

Python-parity quirk: bool_str("false") is "true"; use _bool_str for a lower-cased string form.

Example​

import { bool_str } from "./transforms.js";
bool_str(true); // "true"
bool_str(0); // "false"
bool_str("false"); // "true" (non-empty string)