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
21 - Type Check with Extra Optional Parameters

This is only for type checking parameters and results that are single objects and single arrays. The idea is that extra values, to be ignored, are inside the checked collection variable. Extra optional parameter values are not checked for correct type, they are just ignored. As long as the correct declared type shape is not violated, any additional elective parameters will be overlooked.

Objects specify their mandatory keys and types, whilst arrays just check the beginning elements for types, and ignore the rest undescribed elements.

Thus checkParam_typeExtra(an_object, {a:'string'}) means extra properties inside the parameter_object are allowed after the string property of 'a'.
func0 = (an_object) => an_object
PRE_check_func0 = (an_object) => { 
  return type_czech.checkParam_typeExtra(an_object, {a:'string'})
}
func0 = type_czech.linkUp(func0, PRE_check_func0)
func0({a:'pass'})                          // pass 
func0({a:'pass', b:'string', c:'boolean'}) // pass
func0({fail:17})                           // fail
And checkParam_typeExtra(an_array, 'number') refers to one number and something extra possibly. Only the first element is checked.
func1 = (an_array) => an_array
PRE_check_func1 = (an_array) => { 
  return type_czech.checkParam_typeExtra(an_array, 'number')
}
func1 = type_czech.linkUp(func1, PRE_check_func1)
func1([1, 'pass', 'pass', 'pass'])         // pass
func1(['all-bad', 'fail', 'fail', 'fail']) // fail
Whereas checkParam_typeExtra(an_array, ['number', 'boolean']) refers to two things, a number and a boolean possibly followed by something extra.
func2 = (an_array) => an_array
PRE_check_func2 = (an_array) => { 
  the_signature = ['number', 'boolean']
  return type_czech.checkParam_typeExtra(an_array, the_signature)
}
func2 = type_czech.linkUp(func2, PRE_check_func2)
func2([7, true, 'pass', 'pass', 'pass'])   // pass
func2([8, 'fail', 'fail', 'fail', 'fail']) // fail
Console Output