Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
beforan committed Mar 30, 2018
1 parent f301475 commit 35baad0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/UnitValue.html
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,7 @@ <h5>Example</h5>
<br class="clear">

<footer>
Documentation generated at Fri Mar 30 2018 22:41:43 GMT+0100 (GMT Summer Time)
Documentation generated at Fri Mar 30 2018 22:42:37 GMT+0100 (GMT Summer Time)
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/external-parse-unit.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ <h2>
<br class="clear">

<footer>
Documentation generated at Fri Mar 30 2018 22:41:43 GMT+0100 (GMT Summer Time)
Documentation generated at Fri Mar 30 2018 22:42:37 GMT+0100 (GMT Summer Time)
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/externals.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1 class="page-title">externals.js</h1>
<br class="clear">

<footer>
Documentation generated at Fri Mar 30 2018 22:41:43 GMT+0100 (GMT Summer Time)
Documentation generated at Fri Mar 30 2018 22:42:37 GMT+0100 (GMT Summer Time)
</footer>

<script>prettyPrint();</script>
Expand Down
18 changes: 8 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,17 @@ <h2>Use in the browser</h2><p>Currently there's no standalone build for browser
Also I feel the library is significantly more useful inside modules than in the browser.</p>
<h2>Examples</h2><p>The API Reference Docs give a good sense of what is possible with the library, but here are some examples</p>
<h3>Perform math on CSS values without separating the units and adding them back after</h3><pre class="prettyprint source lang-js"><code>element1.style.width = &quot;100px&quot;;
element2.style.width = UnitValue
.parse(element1.style.width) // turn the existing css value string into a UnitValue
.subtract(30) // make it slightly smaller
.toString(); // returns &quot;70px&quot;</code></pre><h3>Perform math using regular javascript operators, while using the friendly string for UI display</h3><pre class="prettyprint source lang-js"><code>const period = new UnitValue(10, &quot;s&quot;); // amount of time in seconds
myUI.timePeriod = period.toString() // &quot;10s&quot;
element2.style.width = UnitValue.parse(element1.style.width) // turn the existing css value string into a UnitValue
.subtract(30) // make it slightly smaller
.toString(); // returns &quot;70px&quot;</code></pre><h3>Perform math using regular javascript operators, while using the friendly string for UI display</h3><pre class="prettyprint source lang-js"><code>const period = new UnitValue(10, &quot;s&quot;); // amount of time in seconds
myUI.timePeriod = period.toString(); // &quot;10s&quot;

// convert to milliseconds to have a repeating action every 10s
const periodMs = period * 1000; // the js * operator uses `valueOf()` for the UnitValue object, and works normally
setInterval(() => console.log(&quot;hello&quot;), periodMs);</code></pre><h3>Perform unit conversions, changing the units string at the same time as doing the calculation</h3><pre class="prettyprint source lang-js"><code>const length_us = &quot;5 inches&quot;;
const length_international = UnitValue
.parse(length_us) // create a UnitValue from the original value
.multiply(2.54, &quot;cm&quot;) // apply the conversion math and change the resulting units
.toString(); // return a string again - &quot;2.54cm&quot;</code></pre><h1>Build</h1><p><code>npm run lib</code> will run the source through Babel, producing a lib directory which can be consumed in a node.js environment (this is what the npm package is).</p>
const length_international = UnitValue.parse(length_us) // create a UnitValue from the original value
.multiply(2.54, &quot;cm&quot;) // apply the conversion math and change the resulting units
.toString(); // return a string again - &quot;2.54cm&quot;</code></pre><h1>Build</h1><p><code>npm run lib</code> will run the source through Babel, producing a lib directory which can be consumed in a node.js environment (this is what the npm package is).</p>
<h1>Test</h1><p>The library is fully test covered by <code>mocha</code>, with <code>chai</code> expect assertions. <code>nyc</code> assesses and reports on code coverage.</p>
<p>Tests can be run with <code>npm test</code> but the library will need to be built first.</p>
<h1>Documentation</h1><p>The code is documented with jsdoc comments.</p>
Expand All @@ -97,7 +95,7 @@ <h1>Contributing</h1><p>Contributions are welcome. Just raise a PR.</p>
<br class="clear">

<footer>
Documentation generated at Fri Mar 30 2018 22:41:43 GMT+0100 (GMT Summer Time)
Documentation generated at Fri Mar 30 2018 22:42:37 GMT+0100 (GMT Summer Time)
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/unit-value.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ <h1 class="page-title">unit-value.js</h1>
<br class="clear">

<footer>
Documentation generated at Fri Mar 30 2018 22:41:43 GMT+0100 (GMT Summer Time)
Documentation generated at Fri Mar 30 2018 22:42:37 GMT+0100 (GMT Summer Time)
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unit-value",
"version": "1.0.0-beta.5",
"version": "1.0.0",
"description":
"A javascript library for easing working with numeric values that have units associated with them.",
"main": "lib/index.js",
Expand Down

0 comments on commit 35baad0

Please sign in to comment.