GitHub Package
the javascript
40 - Prescribed Use

The intended manner for using TypeCzech is to toggle runtime checking by loading or not loading TypeCzech.js. The below code will render all TypeCzech calls into no-ops when TypeCzech.js is not loaded, virtually no cpu time is lost as can be seen in /time-trials/time-differences.js.
if (typeof TypeCzech === 'function')
  type_czech = TypeCzech('LOG-ERRORS')
else
  type_czech = { linkUp: (nop) => nop, isActive: (x) => false }
Program with TypeCzech testing turned ON.
<script src="../web-resources/TypeCzech.js">
Program with TypeCzech testing turned OFF.
<!-- <script src="../web-resources/TypeCzech.js"> -->
By using the below construct, non-existant PRE and POST checking functions will just be ignored by TypeCzech. Useful for not including large blocks of testing code to the browser that will be parsed. This style stops exceptions when non-existant checking functions are referenced.
PRE_check_aLottery = (typeof PRE_check_aLottery === 'undefined')
                       ? undefined : PRE_check_aLottery

//  function PRE_check_aLottery (){
//    // this function is ignored if does not exist
//  }
Best practice is to use both constructs to handle turning TypeCzech checking functions on and off.
Console Output

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