Core
Framework v2.x
2

getInteger #

Available since 2.11.0

Gets a parameter from a request arguments and checks that it is an integer.

Arguments #

Copied to clipboard!
getInteger (name: string, def: number = null): number

Name Type Description
name
string
Parameter name
def
number
Default value to return if the parameter is not set

Example #

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