One use for the linkUp(your_function, before_test, after_test) construct is
to help with debugging and testing without changing the actual source code. The before and after
conditions of functions can be viewed without asserts actually littering the functions.
Note that any function names can be used, not just PRE_check_function_name() and POST_check_function_name(),
which are used to lessen confusion.
function before_Person(first_name, last_name){
console.log('before Person:', first_name, last_name)
if (first_name.match(/^[a-z]/))
return 'ERROR, first name not capitalized: ' + first_name
}
function Person(first_name, last_name){
console.log('in Person:', first_name, last_name)
return {first: first_name, last: last_name}
}
function person_after(person_result) {
console.log('after Person:', person_result)
}
Person = type_czech.linkUp(Person, before_Person, person_after)
jane_doe = Person('Jane', 'Pass')
john_doe = Person('john', 'fail')
>> ERROR, first name not capitalized: john
Note that PRE_check_Person() and POST_check_Person functions do not need to return anything if no error has
occured; undefined and '' both mean no errors found.