fluentnode
Version:
Fluent apis for node (based on the concepts used in C#'s FluentSharp
298 lines (194 loc) • 11 kB
HTML
<html>
<head>
<title>_to_map_and_write_Tests.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 …</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page">
<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="_register.html">
_register.js
</a>
<a class="source" href="_to_map_and_write_Tests.html">
_to_map_and_write_Tests.litcoffee
</a>
<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="console.html">
console.litcoffee
</a>
<a class="source" href="fs.html">
fs.litcoffee
</a>
<a class="source" href="globals.html">
globals.litcoffee
</a>
<a class="source" href="http.html">
http.litcoffee
</a>
<a class="source" href="index.html">
index.md
</a>
<a class="source" href="path.html">
path.litcoffee
</a>
<a class="source" href="process.html">
process.litcoffee
</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="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="fs.test.html">
fs.test.coffee
</a>
<a class="source" href="globals.test.html">
globals.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>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>_to_map_and_write_Tests.litcoffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<p>These are working methods that need to be added to respective source code file (with a unit test)</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-attribute">Number</span>::assert_In_Between = <span class="hljs-function"><span class="hljs-params">(min,max )</span>-></span> @.in_Between(min,max).assert_Is_True()
<span class="hljs-attribute">String</span>::json_Parse = <span class="hljs-function"><span class="hljs-params">( )</span>-></span> JSON.parse(@)
<span class="hljs-attribute">String</span>::remove = <span class="hljs-function"><span class="hljs-params">(value )</span>-></span> @.replace(value,<span class="hljs-string">''</span>)
<span class="hljs-attribute">String</span>::json_GET = <span class="hljs-function"><span class="hljs-params">(callback)</span>-></span>
@.GET (data)->
callback data.json_Parse()
<span class="hljs-attribute">String</span>::json_GET_With_Timeout = <span class="hljs-function"><span class="hljs-params">(callback)</span>-></span>
@.http_GET_With_Timeout (data)->
callback data.json_Parse()
<span class="hljs-attribute">String</span>::http_GET_With_Timeout = <span class="hljs-function"><span class="hljs-params">(callback)</span>-></span>
timeout = <span class="hljs-number">500</span>
delay = <span class="hljs-number">10</span>;
<span class="hljs-function"> <span class="hljs-title">try_Http_Get</span> = <span class="hljs-params">(next)</span> =></span>
@.GET (data) => <span class="hljs-keyword">if</span> data <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span> <span class="hljs-keyword">then</span> (delay).invoke_After(next) <span class="hljs-keyword">else</span> callback(data)
<span class="hljs-function"> <span class="hljs-title">run_Tests</span> = <span class="hljs-params">(test_Count)</span>=></span> <span class="hljs-keyword">if</span> test_Count.empty() <span class="hljs-keyword">then</span> @.GET (callback) <span class="hljs-keyword">else</span> try_Http_Get ()->run_Tests(test_Count.splice(<span class="hljs-number">0</span>,<span class="hljs-number">1</span>))
run_Tests([<span class="hljs-number">0.</span>. ~~(timeout/delay)])
<span class="hljs-attribute">String</span>::http_GET_Wait_For_Null = <span class="hljs-function"><span class="hljs-params">(callback)</span>-></span>
timeout = <span class="hljs-number">500</span>
delay = <span class="hljs-number">10</span>;
<span class="hljs-function"> <span class="hljs-title">try_Http_Get</span> = <span class="hljs-params">(next)</span> =></span>
@.GET (data) =>
<span class="hljs-keyword">if</span> data <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span> <span class="hljs-keyword">then</span> callback() <span class="hljs-keyword">else</span> next.invoke_In(delay)
<span class="hljs-function"> <span class="hljs-title">run_Tests</span> = <span class="hljs-params">(test_Count)</span>=></span> <span class="hljs-keyword">if</span> test_Count.empty() <span class="hljs-keyword">then</span> @.GET (callback) <span class="hljs-keyword">else</span> try_Http_Get ()->run_Tests(test_Count.splice(<span class="hljs-number">0</span>,<span class="hljs-number">1</span>))
run_Tests([<span class="hljs-number">0.</span>. ~~(timeout/delay)])</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>Static singleton retriever/loader</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Singleton</span></span>
__instance = <span class="hljs-literal">null</span>
<span class="hljs-property">@get</span>: <span class="hljs-function">-></span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> <span class="hljs-property">@__instance</span>?
<span class="hljs-property">@__instance</span> = <span class="hljs-keyword">new</span> @
<span class="hljs-property">@__instance</span>.init()
<span class="hljs-property">@__instance</span></pre></div></div>
</li>
</ul>
</div>
</body>
</html>