parseBool
parseBool<
T>(spec,options?):MapSpec<T>
Defined in: extract/spec.ts:904
Parse a string value into a boolean.
Default truthy values: "true", "1", "yes", "y", "on".
Default falsy values: "false", "0", "no", "n", "off".
Custom truthy/falsy values are added to the defaults.
Produces schemaHint: { type: 'boolean' } for schema derivation.
Type Parameters
Section titled “Type Parameters”T extends Spec
Parameters
Section titled “Parameters”T
options?
Section titled “options?”BoolParseOptions
Returns
Section titled “Returns”MapSpec<T>
Example
Section titled “Example”// Default truthy/falsyparseBool($.get('active').string())
// Custom truthy/falsyparseBool($.get('status').string(), { truthy: ['active'], falsy: ['inactive'] })