Skip to content

Commit

Permalink
Deploy sarahdayan/dinero.js to github.com/sarahdayan/dinero.js.git:ma…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
traviscibot committed Apr 19, 2018
1 parent 13f046e commit 33a3682
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
18 changes: 16 additions & 2 deletions docs/dinero.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,33 +301,47 @@ <h1 class="page-title">
/**
* Returns a new Dinero object that represents the multiplied value by the given factor.
*
* [Banker's rounding](http://wiki.c2.com/?BankersRounding) is used to handle fractional cents.
* This *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
*
* @param {Number} multiplier - The factor to multiply by.
*
* @example
* // returns a Dinero object with amount 1600
* Dinero({ amount: 400 }).multiply(4)
* // returns a Dinero object with amount 800
* Dinero({ amount: 400 }).multiply(2.001)
*
* @return {Dinero}
*/
multiply(multiplier) {
return create.call(this, {
amount: calculator.multiply(this.getAmount(), multiplier)
amount: calculator.bankersRound(
calculator.multiply(this.getAmount(), multiplier)
)
})
},
/**
* Returns a new Dinero object that represents the divided value by the given factor.
*
* [Banker's rounding](http://wiki.c2.com/?BankersRounding) is used to handle fractional cents.
* This *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
*
* @param {Number} divisor - The factor to divide by.
*
* @example
* // returns a Dinero object with amount 100
* Dinero({ amount: 400 }).divide(4)
* // returns a Dinero object with amount 52
* Dinero({ amount: 105 }).divide(2)
*
* @return {Dinero}
*/
divide(divisor) {
return create.call(this, {
amount: calculator.divide(this.getAmount(), divisor)
amount: calculator.bankersRound(
calculator.divide(this.getAmount(), divisor)
)
})
},
/**
Expand Down
50 changes: 29 additions & 21 deletions docs/module-Dinero.html
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,8 @@ <h4 class="name" id="~multiply">

<div class="description">
<p>Returns a new Dinero object that represents the multiplied value by the given factor.</p>
<p><a href="http://wiki.c2.com/?BankersRounding">Banker's rounding</a> is used to handle fractional cents.
This <em>can</em> lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.</p>
</div>


Expand Down Expand Up @@ -1321,7 +1323,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line204">line 204</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line209">line 209</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1356,7 +1358,9 @@ <h5 id="multiply-examples">Example</h5>


<pre class="prettyprint"><code>// returns a Dinero object with amount 1600
Dinero({ amount: 400 }).multiply(4)</code></pre>
Dinero({ amount: 400 }).multiply(4)
// returns a Dinero object with amount 800
Dinero({ amount: 400 }).multiply(2.001)</code></pre>


</div>
Expand Down Expand Up @@ -1385,6 +1389,8 @@ <h4 class="name" id="~divide">

<div class="description">
<p>Returns a new Dinero object that represents the divided value by the given factor.</p>
<p><a href="http://wiki.c2.com/?BankersRounding">Banker's rounding</a> is used to handle fractional cents.
This <em>can</em> lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.</p>
</div>


Expand Down Expand Up @@ -1482,7 +1488,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line220">line 220</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line232">line 232</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1517,7 +1523,9 @@ <h5 id="divide-examples">Example</h5>


<pre class="prettyprint"><code>// returns a Dinero object with amount 100
Dinero({ amount: 400 }).divide(4)</code></pre>
Dinero({ amount: 400 }).divide(4)
// returns a Dinero object with amount 52
Dinero({ amount: 105 }).divide(2)</code></pre>


</div>
Expand Down Expand Up @@ -1643,7 +1651,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line238">line 238</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line252">line 252</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1841,7 +1849,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line270">line 270</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line284">line 284</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2041,7 +2049,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line311">line 311</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line325">line 325</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2214,7 +2222,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line330">line 330</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line344">line 344</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2410,7 +2418,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line353">line 353</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line367">line 367</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2610,7 +2618,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line373">line 373</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line387">line 387</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2806,7 +2814,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line396">line 396</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line410">line 410</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -2951,7 +2959,7 @@ <h4 class="name" id="~isZero">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line412">line 412</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line426">line 426</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3061,7 +3069,7 @@ <h4 class="name" id="~isPositive">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line430">line 430</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line444">line 444</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3175,7 +3183,7 @@ <h4 class="name" id="~isNegative">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line448">line 448</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line462">line 462</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3289,7 +3297,7 @@ <h4 class="name" id="~hasCents">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line463">line 463</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line477">line 477</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3454,7 +3462,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line480">line 480</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line494">line 494</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3619,7 +3627,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line497">line 497</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line511">line 511</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3833,7 +3841,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line540">line 540</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line554">line 554</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3951,7 +3959,7 @@ <h4 class="name" id="~toUnit">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line562">line 562</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line576">line 576</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -4112,7 +4120,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line575">line 575</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line589">line 589</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -4218,7 +4226,7 @@ <h4 class="name" id="~toObject">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line591">line 591</a>
<a href="dinero.js.html">dinero.js</a>, <a href="dinero.js.html#line605">line 605</a>
</li>
</ul>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dinero.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "An immutable library to create, calculate and format monetary values.",
"author": "Sarah Dayan",
"keywords": [
Expand Down

0 comments on commit 33a3682

Please sign in to comment.