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 #
getBoolean (name: string): boolean;
Name | Type | Description |
---|---|---|
name | string | Parameter name |
Example #
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
Edit this page on Github (opens new window)