04 - Check Parameters in a Closure and its Functions
by steen_hansen
HTML
<!DOCTYPE html><meta charset="utf-8" />
<title>04 Turn off TypeCzech by Not Loading Checking Functions</title>
<div id='js-div' style="width:47%">
<a href='https://github.com/steenhansen/type-czech' target="_blank" class='git-hub'>GitHub Package</a>
<div id='js-code'>the javascript</div>
</div>
<div id="the-explanation" style="width:53%">
<div class='an-explantion'>04 - Turn off TypeCzech by Not Loading Checking Functions</div>
<div id='explanation-text'>
<br>
Another way of turning off PRE & POST function checking with TypeCzech is to not
declare any checking functions.
But this method needs the below line to ignore the commented out checking function,
and not cause a ReferenceError. This is why the example code to the left does not
complain.
<pre>
PRE_check_Person = (typeof PRE_check_Person==='undefined')
? undefined : PRE_check_Person
</pre>
Furthermore, the TypeCzech library can also be turned off by not choosing
'LOG-ERRORS' or 'THROW-EXCEPTIONS' in the constructor, and instead having
no arguments, or 'NO-CHECKING', as below.
<pre>
type_czech = TypeCzech()
OR
type_czech = TypeCzech('NO-CHECKING')
</pre>
The last option to stop function checking is to not link any functions to the TypeCzech library, as is accomplished
by commenting out all type_czech.linkUp() calls. Thus Person will not be linked into TypeCzech,
and the PRE checking function will be ignored.
<pre>
// Person = type_czech.linkUp(Person, PRE_check_Person) )
</pre>
TypeCzech is loaded and parsed in this page, but does no checking.
<br><br>
</div>
<div id="console-log" >
<div class='a-title'>Console Output</div>
<div id='log-text'></div>
<br>
</div>
<br><br>
<!-- ------------------TYPE 1------------------------ -->
<script src="https://cdn.jsdelivr.net/gh/steenhansen/type-czech@latest/web-resources/consolelog.js"></script>
<script...