Skip to content

@technobuddha > library > Object > Conversion

Function: toBoolean()

ts
function toBoolean(input: string, options: BooleanOptions): undefined | boolean;

Defined in: to-boolean.ts:36

Convert a string to a boolean value

Parameters

ParameterTypeDescription
inputstringThe string to convert
optionsBooleanOptionssee BooleanOptions

Returns

undefined | boolean

Default Value

ts
trueValues 'true', 'yes', 'y', 'on', or '1'

Default Value

ts
falseValues 'false', 'no', 'n', 'off', '0'