Skip to content

Commit

Permalink
Add normalizeUOM option to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeboone02 committed Feb 15, 2021
1 parent 03991a7 commit e9a52e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ <h4>Ingredient List</h4>
>
<br />
<button type="button" id="parse">Parse</button>
<label>
<input type="checkbox" id="normalize-uom" />
Normalize units of measure
</label>
<h4>Results</h4>
<pre id="results" class="language-json">
(Click "Parse" to see results.)</pre
Expand All @@ -147,14 +151,17 @@ <h4>Results</h4>
Copyright © 2021 <a href="https://github.com/jakeboone02">Jake Boone</a>
</footer>
<script src="https://unpkg.com/[email protected]/dist/numeric-quantity.umd.production.min.js"></script>
<script src="https://unpkg.com/parse-ingredient@0.2.4/dist/parse-ingredient.umd.production.min.js"></script>
<script src="https://unpkg.com/parse-ingredient@0.3.0/dist/parse-ingredient.umd.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<script>
document
.getElementById('parse')
.addEventListener('click', function(event) {
var normalizeUOM = document.getElementById('normalize-uom').checked;
document.getElementById('results').innerHTML = JSON.stringify(
parseIngredient(document.getElementById('ingredient-list').value),
parseIngredient(document.getElementById('ingredient-list').value, {
normalizeUOM: normalizeUOM,
}),
null,
2
);
Expand Down

0 comments on commit e9a52e3

Please sign in to comment.