contract
The contract module provides helper functions to assist in enforcing the contracts of your class methods, such as requiring an int or a string parameter.
Contract
static number(name, x)
Aborts the fiber with an error if x
is not a number. The name
parameter
should be the name of the parameter from which x
is derived.
static int(name, x)
Aborts the fiber with an error if x
is not an integer. The name
parameter should be the name of the parameter from which x
is derived.
static uint(name, x)
Aborts the fiber with an error if x
is not a positive integer or zero. The
name
parameter should be the name of the parameter from which x
is
derived.
static string(name, x)
Aborts the fiber with an error if x
is not a string. The name
parameter
should be the name of the parameter from which x
is derived.