Skip to content

Commit

Permalink
Add allowLeadingOf option to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeboone02 committed Mar 31, 2022
1 parent 6179f98 commit 977cbe0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,25 @@ <h4>Ingredient List</h4>
2 cups all-purpose flour (spooned and leveled), plus more for pans
2 teaspoons baking soda
1/2 teaspoon baking powder
2 teaspoons ground cinnamon
2 teaspoons of ground cinnamon
1/2 teaspoon ground ginger
3⁄4 teaspoon salt
2 cups packed light-brown sugar
2 large eggs
4 Granny Smith apples, peeled, two coarsely grated and two diced</textarea
>
<br />
<button type="button" id="parse">Parse</button>
<label>
<input type="checkbox" id="normalize-uom" />
Normalize units of measure
</label>
<br />
<label>
<input type="checkbox" id="allow-leading-of" />
Allow leading "of "
</label>
<br />
<button type="button" id="parse">Parse</button>
<h4>Results</h4>
<pre id="results" class="language-json">
(Click "Parse" to see results.)</pre
Expand All @@ -158,9 +164,11 @@ <h4>Results</h4>
.getElementById('parse')
.addEventListener('click', function(event) {
var normalizeUOM = document.getElementById('normalize-uom').checked;
var allowLeadingOf = document.getElementById('allow-leading-of').checked;
document.getElementById('results').innerHTML = JSON.stringify(
ParseIngredient.parseIngredient(document.getElementById('ingredient-list').value, {
normalizeUOM: normalizeUOM,
allowLeadingOf: allowLeadingOf,
}),
null,
2
Expand Down

0 comments on commit 977cbe0

Please sign in to comment.