UNPKG

fluentnode

Version:

Fluent apis for node (based on the concepts used in C#'s FluentSharp

486 lines (315 loc) 17 kB
<!DOCTYPE html> <html> <head> <title>assert_Array.litcoffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <ul id="jump_to"> <li> <a class="large" href="javascript:void(0);">Jump To &hellip;</a> <a class="small" href="javascript:void(0);">+</a> <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="assert_Array.html"> assert_Array.litcoffee </a> <a class="source" href="assert_Boolean.html"> assert_Boolean.litcoffee </a> <a class="source" href="assert_Function.html"> assert_Function.litcoffee </a> <a class="source" href="assert_Number.html"> assert_Number.litcoffee </a> <a class="source" href="assert_Object.html"> assert_Object.litcoffee </a> <a class="source" href="assert_String.html"> assert_String.litcoffee </a> <a class="source" href="fluentnode.html"> fluentnode.coffee </a> <a class="source" href="index.html"> index.md </a> <a class="source" href="Array.html"> Array.litcoffee </a> <a class="source" href="Boolean.html"> Boolean.litcoffee </a> <a class="source" href="Function.html"> Function.litcoffee </a> <a class="source" href="Number.html"> Number.litcoffee </a> <a class="source" href="Object.html"> Object.litcoffee </a> <a class="source" href="String.html"> String.litcoffee </a> <a class="source" href="console.html"> console.litcoffee </a> <a class="source" href="crypto.html"> crypto.litcoffee </a> <a class="source" href="fs.html"> fs.litcoffee </a> <a class="source" href="http.GET.html"> http.GET.litcoffee </a> <a class="source" href="http.POST.html"> http.POST.litcoffee </a> <a class="source" href="http.Server.html"> http.Server.litcoffee </a> <a class="source" href="http.html"> http.litcoffee </a> <a class="source" href="path.html"> path.litcoffee </a> <a class="source" href="process.html"> process.litcoffee </a> <a class="source" href="encoding.html"> encoding.litcoffee </a> <a class="source" href="globals.html"> globals.litcoffee </a> <a class="source" href="assert_Array.test.html"> assert_Array.test.coffee </a> <a class="source" href="assert_Boolean.test.html"> assert_Boolean.test.coffee </a> <a class="source" href="assert_Function.test.html"> assert_Function.test.coffee </a> <a class="source" href="assert_Number.test.html"> assert_Number.test.coffee </a> <a class="source" href="assert_Object.test.html"> assert_Object.test.coffee </a> <a class="source" href="assert_String.test.html"> assert_String.test.coffee </a> <a class="source" href="fluentnode.test.html"> fluentnode.test.coffee </a> <a class="source" href="Array.test.html"> Array.test.coffee </a> <a class="source" href="Boolean.test.html"> Boolean.test.coffee </a> <a class="source" href="Function.test.html"> Function.test.coffee </a> <a class="source" href="Number.test.html"> Number.test.coffee </a> <a class="source" href="Object.test.html"> Object.test.coffee </a> <a class="source" href="String.test.html"> String.test.coffee </a> <a class="source" href="console.test.html"> console.test.coffee </a> <a class="source" href="crypto.test.html"> crypto.test.coffee </a> <a class="source" href="fs.test.html"> fs.test.coffee </a> <a class="source" href="http.GET.test.html"> http.GET.test.coffee </a> <a class="source" href="http.POST.test.html"> http.POST.test.coffee </a> <a class="source" href="http.Server.test.html"> http.Server.test.coffee </a> <a class="source" href="http.test.html"> http.test.coffee </a> <a class="source" href="path.test.html"> path.test.coffee </a> <a class="source" href="process.test.html"> process.test.coffee </a> <a class="source" href="encoding.test.html"> encoding.test.coffee </a> <a class="source" href="globals.test.html"> globals.test.coffee </a> </div> </li> </ul> <ul class="sections"> <li id="title"> <div class="annotation"> <h1>assert_Array.litcoffee</h1> </div> </li> <li id="section-1"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>dependencies</p> </div> <div class="content"><div class='highlight'><pre>assert = <span class="hljs-built_in">require</span>(<span class="hljs-string">'assert'</span>)</pre></div></div> </li> <li id="section-2"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p><strong>Array::assert_Is_Array</strong> [message]</p> <p>Confirms that a particular object is an array</p> <p>note: Ideally we could do something like <code>assert.equal(typeof(@), &#39;array&#39;, message)</code> but that is not working</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Is_Array = <span class="hljs-function"><span class="hljs-params">(message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Is_Array]"</span> (<span class="hljs-keyword">typeof</span>(@.length)).assert_Is_Equal_To(<span class="hljs-string">'number'</span>) assert.equal(<span class="hljs-keyword">typeof</span>(@), <span class="hljs-string">'object'</span>, message) @</pre></div></div> </li> <li id="section-3"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p><strong>Array::assert_Contains</strong> value, [message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Contains = <span class="hljs-function"><span class="hljs-params">(value, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Contains]"</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">instanceof</span> Array <span class="hljs-keyword">for</span> item <span class="hljs-keyword">in</span> value @.contains(item).assert_Is_True(<span class="hljs-string">"<span class="hljs-subst">#{item}</span> not found in array: <span class="hljs-subst">#{@}</span>"</span>) <span class="hljs-keyword">else</span> message = message || <span class="hljs-string">"[assert_Contains]"</span> @.contains(value).assert_Is_True(message) @</pre></div></div> </li> <li id="section-4"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p><strong>Array::assert_Empty</strong> value,[message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Empty = <span class="hljs-function"><span class="hljs-params">(value, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Empty]"</span> <span class="hljs-property">@assert_Size_Is</span>(<span class="hljs-number">0</span>, message) @</pre></div></div> </li> <li id="section-5"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p><strong>Array::assert_Not_Contains</strong> value, [message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Not_Contains = <span class="hljs-function"><span class="hljs-params">(value, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Contains]"</span> @.not_Contains(value).assert_Is_True(message) @</pre></div></div> </li> <li id="section-6"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p><strong>Array::assert_Not_Empty</strong> value,[message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Not_Empty = <span class="hljs-function"><span class="hljs-params">(value, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Not_Empty]"</span> <span class="hljs-property">@assert_Size_Is_Not</span>(<span class="hljs-number">0</span>, message) @</pre></div></div> </li> <li id="section-7"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p><strong>Array::assert_Size_Is</strong> size,[message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Size_Is = <span class="hljs-function"><span class="hljs-params">(size, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Size_Is] expected <span class="hljs-subst">#{@.length}</span> and it was <span class="hljs-subst">#{size}</span>"</span> assert.equal(@.length, size, message) @</pre></div></div> </li> <li id="section-8"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p><strong>Array::assert_Size_Is_Bigger_Than</strong> size,[message]</p> <p>Asserts that the size of the @ array is bigger than <code>size</code></p> <p>twin methods: assert_Size_Is_Greater_Than , assert_Size_Is_Above, assert_Is_Greater_Than , assert_Is_Bigger_Than, assert_Greater_Than, assert_Bigger_Than</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than = <span class="hljs-function"><span class="hljs-params">(size, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Size_Is_Bigger_Than] expected bigger than <span class="hljs-subst">#{size}</span>, but it was <span class="hljs-subst">#{@.length}</span> "</span> (@.length &gt; size).assert_Is_True(message) @ <span class="hljs-attribute">Array</span>::assert_Size_Is_Greater_Than = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than <span class="hljs-attribute">Array</span>::assert_Size_Is_Above = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than <span class="hljs-attribute">Array</span>::assert_Is_Greater_Than = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than <span class="hljs-attribute">Array</span>::assert_Is_Bigger_Than = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than <span class="hljs-attribute">Array</span>::assert_Greater_Than = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than <span class="hljs-attribute">Array</span>::assert_Bigger_Than = <span class="hljs-attribute">Array</span>::assert_Size_Is_Bigger_Than</pre></div></div> </li> <li id="section-9"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p><strong>Array::assert_Size_Is_Not</strong> size,[message]</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-attribute">Array</span>::assert_Size_Is_Not = <span class="hljs-function"><span class="hljs-params">(size, message)</span>-&gt;</span> message = message || <span class="hljs-string">"[assert_Size_Is_Not]"</span> assert.notEqual(@.length, size, message) @</pre></div></div> </li> <li id="section-10"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-10">&#182;</a> </div> <hr> </div> </li> <li id="section-11"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>back to <a href="index.html">index</a></p> </div> </li> </ul> </div> </body> </html>