Closed codingedgar closed 1 year ago
The 2nd point is probably not realistically feasible. There are just far too many ingredients and methods of preparation to deal with. Consider kosher salt vs table salt .. anything that can be sliced, diced, chopped, minced... packed vs loose brown sugar, or dried parsley vs fresh.. you get the idea. Each variation results in different weight/vol.. in some cases the difference can be drastic.
I'm sure it could just include the ubiquitous ingredients like flour/sugar/salt/etc, but then it has pretty limited usefulness.
For what it's worth, UnitMath does have the capability of defining custom units. This will get even easier in v1.0.0, which is almost ready. So you could, for instance, add the different cup variants, assigning each to a different system, and then easily convert between them.
To the second point of converting between volume and mass, that can be done using unit arithmetic by multiplying or dividing by the density of the ingredient. It's beyond the scope of this library to define what those densities are, but you could definitely do that in another project that imports UnitMath to do the arithmetic.
Referencing https://github.com/josdejong/mathjs/issues/1449#issuecomment-536841614
For the second point maybe a complement like Moment timezone, could store all the transformations density of common ingredient, and some way to add explicit densities would be great.