GitHub Package
the javascript

Contents 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43    101 102 103 201 202 203 204 301 302 303 304 401 402 403 404 501 502 503 504 601 602 603 604    700 701 702 703 704 705 706 707 708 709 710 © 2024 Steen Hansen
28 - Accept Null and Undefined Values

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. 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.

Console Output