numbr
Version:
A fast number formatting library, based on Numeral.js
436 lines (148 loc) • 6.05 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: CompiledFormat</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: CompiledFormat</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="numbr.html">numbr</a>.</span>
CompiledFormat
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="CompiledFormat"><span class="type-signature"></span>new CompiledFormat<span class="signature">(steps, opts, sortedPos)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
A wrapper object for compiled formats.
</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>steps</code></td>
<td class="type">
<span class="param-type">Array.<Step></span>
</td>
<td class="description last">An array of step functions to be called during CompiledFormat#run</td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A options object that will be passed to every step function as part of the run state</td>
</tr>
<tr>
<td class="name"><code>sortedPos</code></td>
<td class="type">
<span class="param-type">Array.<number></span>
</td>
<td class="description last">An array of output position indexes of each step in steps</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="numbr.js.html">numbr.js</a>, <a href="numbr.js.html#line221">line 221</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="run"><span class="type-signature"></span>run<span class="signature">(num, roundFn, lang)</span><span class="type-signature"> → {string}</span></h4>
</dt>
<dd>
<div class="description">
Runs all the transformation step functions using the given number and rounding function.
</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>num</code></td>
<td class="type">
</td>
<td class="description last">The number to format</td>
</tr>
<tr>
<td class="name"><code>roundFn</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">A rounding function</td>
</tr>
<tr>
<td class="name"><code>lang</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The language code</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="numbr.js.html">numbr.js</a>, <a href="numbr.js.html#line235">line 235</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The formatted number
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="numbr.CompiledFormat.html">CompiledFormat</a></li><li><a href="numbr.Consumer.html">Consumer</a></li><li><a href="numbr.Numbr.html">Numbr</a></li><li><a href="numbr.Step.html">Step</a></li></ul><h3>Namespaces</h3><ul><li><a href="numbr.html">numbr</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 30 2014 02:08:18 GMT-0500 (Central Daylight Time (Mexico))
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>