Framework v2.x

getBoolean #

Available since 2.16.9

Gets a parameter from the request arguments and checks that it is a boolean. We also support lodash syntax. (relations.lebron[0])

Contrary to other parameter types, an unset boolean does not trigger an error, instead it's considered as false

Arguments #

Copied to clipboard!
getBoolean (name: string): boolean;

Name Type Description
Parameter name

Example #

Copied to clipboard!
const disabled = request.getBoolean('disabled');
// equivalent
const disabled = request.input.args.disabled;
//+ checks to make sure that "disabled" is of the right type
// and throw standard API error when it's not the case