When using the 'UNDEF-OK' option with TypeCzech creation, 'null' and 'undefined' values are allowed
to pass through error free in parameter type checking. The values 'null' and 'undefined' are still however
considered empty. In other words, null and undefined are treated as type wildcards.
- null - absence of any value
- undefined - an un-assigned value
The 'UNDEF-OK' option is only useful with type shapes, and thus these functions:
- checkParam_type()
- checkParam_typeExtra()
- checkParam_typeEither()
- checkArgs_typeEach()
type_czech = TypeCzech('UNDEF-OK','LOG-ERRORS')
function PRE_check_variadicStrs() {
return type_czech.checkArgs_typeEach(arguments, 'string')
}
variadicStrs=type_czech.linkUp(variadicStrs, PRE_check_variadicStrs)
function variadicStrs () { console.log(arguments)}
variadicStrs('pass', null, undefined, 'the', 'check') // pass
In this page's example, null and undefined do not cause any errors with checkParam_type().
But otherwise, real values are still checked for type, such as 12 not being a string
which causes a PRE_check_Person() and POST_check_Person() error.