Typeless arrays can be checked for without giving any dimensionality,
if [ ]s are used then an array must define at least one type.
- Valid Type: 'array' - an array of anything
- Valid Type : [ 'string' ] - an array containing one string element
- Valid Type : [ 'strings' ] - an array of 1 or more strings
- Not Valid Type : '[ ]'
And, 'object' can also be a type without specifying any properties.
But if { }s are used then an object must define at least one key and value.
- Valid Type : 'object' - a single object
- Valid Type : { a_key: 'string' } - a single object with a_key property
- Valid Type : ['objects'] - an array of objects
- Not Valid Type : '{ }'
airplanes = [{manu:'Lockheed', name:'Starfighter'}, {manu:'Avro', name:'Vulcan'}]
type_czech.checkParam_type(airplanes, ['objects']) // pass
movie_array = ["Red Rock West", "Breakfast at Tiffany's", "Blue Velvet"]
type_czech.checkParam_type(movie_array, ['objects']) // fail
Alan Turing is used to show the error messages that occur when an object is checkParam_type()ed against the
'array' type in the PRE_check_Person() checking function.
The reverse, testing an array against the 'object' type is then shown in the POST_check_Person() function.