mirror of https://github.com/codefeathers/fuse
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							844 lines
						
					
					
						
							9.9 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							844 lines
						
					
					
						
							9.9 KiB
						
					
					
				| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
|     <meta charset="utf-8"> | |
|     <title>JSDoc: Class: FuseIterable</title> | |
| 
 | |
|     <script src="scripts/prettify/prettify.js"> </script> | |
|     <script src="scripts/prettify/lang-css.js"> </script> | |
|     <!--[if lt IE 9]> | |
|       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
|     <![endif]--> | |
|     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | |
|     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | |
| </head> | |
| 
 | |
| <body> | |
| 
 | |
| <div id="main"> | |
| 
 | |
|     <h1 class="page-title">Class: FuseIterable</h1> | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <section> | |
| 
 | |
| <header> | |
|      | |
|         <h2><span class="attribs"><span class="type-signature"></span></span>FuseIterable<span class="signature">(values, tests)</span><span class="type-signature"></span></h2> | |
|          | |
|             <div class="class-description">FuseIterable</div> | |
|          | |
|      | |
| </header> | |
| 
 | |
| <article> | |
|     <div class="container-overview"> | |
|      | |
|          | |
| 
 | |
|      | |
|     <h2>Constructor</h2> | |
|      | |
| 
 | |
|      | |
|     <h4 class="name" id="FuseIterable"><span class="type-signature"></span>new FuseIterable<span class="signature">(values, tests)</span><span class="type-signature"></span></h4> | |
|      | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     <h5>Parameters:</h5> | |
|      | |
| 
 | |
| <table class="params"> | |
|     <thead> | |
|     <tr> | |
|          | |
|         <th>Name</th> | |
|          | |
| 
 | |
|         <th>Type</th> | |
| 
 | |
|          | |
| 
 | |
|          | |
| 
 | |
|         <th class="last">Description</th> | |
|     </tr> | |
|     </thead> | |
| 
 | |
|     <tbody> | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>values</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">iterable</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">An iterable expression as the switch</td> | |
|         </tr> | |
| 
 | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>tests</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">Array.<function()></span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Array of { test, consequent } objects | |
|                 <h6>Properties</h6> | |
|                  | |
| 
 | |
| <table class="params"> | |
|     <thead> | |
|     <tr> | |
|          | |
|         <th>Name</th> | |
|          | |
| 
 | |
|         <th>Type</th> | |
| 
 | |
|          | |
| 
 | |
|          | |
| 
 | |
|         <th class="last">Description</th> | |
|     </tr> | |
|     </thead> | |
| 
 | |
|     <tbody> | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>predicate</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">function</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Test function</td> | |
|         </tr> | |
| 
 | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>consequent</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">function</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Consequent function</td> | |
|         </tr> | |
| 
 | |
|      | |
|     </tbody> | |
| </table> | |
| 
 | |
|             </td> | |
|         </tr> | |
| 
 | |
|      | |
|     </tbody> | |
| </table> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <dl class="details"> | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <dt class="tag-source">Source:</dt> | |
|     <dd class="tag-source"><ul class="dummy"><li> | |
|         <a href="index.js.html">index.js</a>, <a href="index.js.html#line63">line 63</a> | |
|     </li></ul></dd> | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| </dl> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|      | |
|     </div> | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
|         <h3 class="subsection-title">Methods</h3> | |
| 
 | |
|          | |
|              | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <h4 class="name" id="on"><span class="type-signature"></span>on<span class="signature">(predicate, consequent)</span><span class="type-signature"> → {<a href="FuseIterable.html">FuseIterable</a>}</span></h4> | |
|      | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| <div class="description"> | |
|     Accepts a test and consequent function each and returns a new | |
| FuseIterable instance. | |
| FuseIterable.prototype.for works a little differently than | |
| Fuse.prototype.for, by lazy accumulating the tests and | |
| resolving all the values when .resolve() is called. | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     <h5>Parameters:</h5> | |
|      | |
| 
 | |
| <table class="params"> | |
|     <thead> | |
|     <tr> | |
|          | |
|         <th>Name</th> | |
|          | |
| 
 | |
|         <th>Type</th> | |
| 
 | |
|          | |
| 
 | |
|          | |
| 
 | |
|         <th class="last">Description</th> | |
|     </tr> | |
|     </thead> | |
| 
 | |
|     <tbody> | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>predicate</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">callback</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">A test callback function</td> | |
|         </tr> | |
| 
 | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>consequent</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">callback</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Consequent callback function</td> | |
|         </tr> | |
| 
 | |
|      | |
|     </tbody> | |
| </table> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <dl class="details"> | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <dt class="tag-source">Source:</dt> | |
|     <dd class="tag-source"><ul class="dummy"><li> | |
|         <a href="index.js.html">index.js</a>, <a href="index.js.html#line83">line 83</a> | |
|     </li></ul></dd> | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| </dl> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <h5>Returns:</h5> | |
| 
 | |
|          | |
| <div class="param-desc"> | |
|     An instance of FuseIterable | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| <dl> | |
|     <dt> | |
|         Type | |
|     </dt> | |
|     <dd> | |
|          | |
| <span class="param-type"><a href="FuseIterable.html">FuseIterable</a></span> | |
| 
 | |
| 
 | |
|     </dd> | |
| </dl> | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|          | |
|              | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <h4 class="name" id="onField"><span class="type-signature"></span>onField<span class="signature">(…tuples)</span><span class="type-signature"> → {<a href="FuseIterable.html">FuseIterable</a>}</span></h4> | |
|      | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| <div class="description"> | |
|     Accepts a list of tuples as arguments and returns a new | |
| FuseIterable instance. An alternative to chaining multiple | |
| FuseIterable.prototype.on methods. | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     <h5>Parameters:</h5> | |
|      | |
| 
 | |
| <table class="params"> | |
|     <thead> | |
|     <tr> | |
|          | |
|         <th>Name</th> | |
|          | |
| 
 | |
|         <th>Type</th> | |
| 
 | |
|          | |
|         <th>Attributes</th> | |
|          | |
| 
 | |
|          | |
| 
 | |
|         <th class="last">Description</th> | |
|     </tr> | |
|     </thead> | |
| 
 | |
|     <tbody> | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>tuples</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">Array.<function()></span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
|                 <td class="attributes"> | |
|                  | |
| 
 | |
|                  | |
| 
 | |
|                  | |
|                     <repeatable><br> | |
|                  | |
|                 </td> | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Array of [ predicate, consequent ] pairs</td> | |
|         </tr> | |
| 
 | |
|      | |
|     </tbody> | |
| </table> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <dl class="details"> | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <dt class="tag-source">Source:</dt> | |
|     <dd class="tag-source"><ul class="dummy"><li> | |
|         <a href="index.js.html">index.js</a>, <a href="index.js.html#line99">line 99</a> | |
|     </li></ul></dd> | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| </dl> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <h5>Returns:</h5> | |
| 
 | |
|          | |
| <div class="param-desc"> | |
|     An instance of FuseIterable | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| <dl> | |
|     <dt> | |
|         Type | |
|     </dt> | |
|     <dd> | |
|          | |
| <span class="param-type"><a href="FuseIterable.html">FuseIterable</a></span> | |
| 
 | |
| 
 | |
|     </dd> | |
| </dl> | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|          | |
|              | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <h4 class="name" id="resolve"><span class="type-signature"></span>resolve<span class="signature">(…args)</span><span class="type-signature"> → {any|null}</span></h4> | |
|      | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| <div class="description"> | |
|     Accepts parameters during resolve time and passes them along with | |
| each value into the winning consequent function. | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     <h5>Parameters:</h5> | |
|      | |
| 
 | |
| <table class="params"> | |
|     <thead> | |
|     <tr> | |
|          | |
|         <th>Name</th> | |
|          | |
| 
 | |
|         <th>Type</th> | |
| 
 | |
|          | |
|         <th>Attributes</th> | |
|          | |
| 
 | |
|          | |
| 
 | |
|         <th class="last">Description</th> | |
|     </tr> | |
|     </thead> | |
| 
 | |
|     <tbody> | |
|      | |
| 
 | |
|         <tr> | |
|              | |
|                 <td class="name"><code>args</code></td> | |
|              | |
| 
 | |
|             <td class="type"> | |
|              | |
|                  | |
| <span class="param-type">any</span> | |
| 
 | |
| 
 | |
|              | |
|             </td> | |
| 
 | |
|              | |
|                 <td class="attributes"> | |
|                  | |
| 
 | |
|                  | |
| 
 | |
|                  | |
|                     <repeatable><br> | |
|                  | |
|                 </td> | |
|              | |
| 
 | |
|              | |
| 
 | |
|             <td class="description last">Any number of arguments</td> | |
|         </tr> | |
| 
 | |
|      | |
|     </tbody> | |
| </table> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <dl class="details"> | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
|     <dt class="tag-source">Source:</dt> | |
|     <dd class="tag-source"><ul class="dummy"><li> | |
|         <a href="index.js.html">index.js</a>, <a href="index.js.html#line114">line 114</a> | |
|     </li></ul></dd> | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| </dl> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <h5>Returns:</h5> | |
| 
 | |
|          | |
| <div class="param-desc"> | |
|     Resolved value or null if it was unresolved | |
| </div> | |
| 
 | |
| 
 | |
| 
 | |
| <dl> | |
|     <dt> | |
|         Type | |
|     </dt> | |
|     <dd> | |
|          | |
| <span class="param-type">any</span> | |
| | | |
| 
 | |
| <span class="param-type">null</span> | |
| 
 | |
| 
 | |
|     </dd> | |
| </dl> | |
| 
 | |
|      | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|          | |
|      | |
| 
 | |
|      | |
| 
 | |
|      | |
| </article> | |
| 
 | |
| </section> | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| </div> | |
| 
 | |
| <nav> | |
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Fuse.html">Fuse</a></li><li><a href="FuseItem.html">FuseItem</a></li><li><a href="FuseIterable.html">FuseIterable</a></li></ul><h3><a href="global.html">Global</a></h3> | |
| </nav> | |
| 
 | |
| <br class="clear"> | |
| 
 | |
| <footer> | |
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Apr 11 2018 11:02:55 GMT+0530 (IST) | |
| </footer> | |
| 
 | |
| <script> prettyPrint(); </script> | |
| <script src="scripts/linenumber.js"> </script> | |
| </body> | |
| </html> |