11 Nov 2022 |
idea
Dynamic scaling of ingredients
todoBaking often requires precise measurements when it comes to ingredients. I find myself doing arithmetic in these scenarios:
- unit conversions (temperature and mass <–> volume)
- scaling recipes by a constant factor
- scaling recipes by an ingredient
- Example: I have a recipe for bread that requires 2500g of flour, but I only have 2000g.
I want to dynamically create some rules that capture data via regex. For example,
= "2500g of flour"
text = /(\d+)\s?(g)/ weightRegex
and parse the captured data [value: 2000, unit: g]
into a table. Then, some Airtable-like UI should exist
allowing me to arbitrarily transform the captured data. I should be able to
replace the text in the ingredients list and the recipe text.
value | unit | scaledValue |
---|---|---|
2500 | g | 1000 |