FunctionSelect: Select a function that passes a condition. A functional alternative to switch-case.
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.

985 lines
11 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Select</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: Select</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Select<span class="signature">()</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Select"><span class="type-signature"></span>new Select<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Creates a new Select instance.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Select.js.html">Select.js</a>, <a href="Select.js.html#line95">line 95</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="SelectValue.html">SelectValue</a></li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="for"><span class="type-signature"></span>for<span class="signature">(test, consequent)</span><span class="type-signature"> &rarr; {<a href="Select.html">Select</a>|<a href="SelectIterable.html">SelectIterable</a>}</span></h4>
<div class="description">
Accepts a test and consequent function each and returns a new
Select or SelectIterable instance.
</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>test</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">test callback 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 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="Select.js.html">Select.js</a>, <a href="Select.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Returns a SelectIterable instance
if value was array, or a Select instance otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Select.html">Select</a></span>
|
<span class="param-type"><a href="SelectIterable.html">SelectIterable</a></span>
</dd>
</dl>
<h4 class="name" id="resolve"><span class="type-signature"></span>resolve<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
<div class="description">
Default resolve prototype. Returns null when called.
Used in case a resolve is never set.
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="SelectValue.html#resolve">SelectValue#resolve</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Select.js.html">Select.js</a>, <a href="Select.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
null
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</article>
</section>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Select<span class="signature">(value, resolve)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Select"><span class="type-signature"></span>new Select<span class="signature">(value, resolve)</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>value</code></td>
<td class="type">
<span class="param-type">any</span>
|
<span class="param-type">array</span>
</td>
<td class="description last">the value or array of values to check against</td>
</tr>
<tr>
<td class="name"><code>resolve</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">optional resolve function</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Select.js.html">Select.js</a>, <a href="Select.js.html#line106">line 106</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="for"><span class="type-signature"></span>for<span class="signature">(test, consequent)</span><span class="type-signature"> &rarr; {<a href="Select.html">Select</a>|<a href="SelectIterable.html">SelectIterable</a>}</span></h4>
<div class="description">
Accepts a test and consequent function each and returns a new
Select or SelectIterable instance.
</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>test</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">test callback 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 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="Select.js.html">Select.js</a>, <a href="Select.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Returns a SelectIterable instance
if value was array, or a Select instance otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Select.html">Select</a></span>
|
<span class="param-type"><a href="SelectIterable.html">SelectIterable</a></span>
</dd>
</dl>
<h4 class="name" id="resolve"><span class="type-signature"></span>resolve<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
<div class="description">
Default resolve prototype. Returns null when called.
Used in case a resolve is never set.
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="SelectValue.html#resolve">SelectValue#resolve</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Select.js.html">Select.js</a>, <a href="Select.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
null
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Select.html">Select</a></li><li><a href="SelectIterable.html">SelectIterable</a></li><li><a href="SelectValue.html">SelectValue</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Apr 10 2018 04:36:07 GMT+0530 (IST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>