jscheiny/safe-units

value in an unit

raoz opened this issue · 2 comments

raoz commented

Hello!

Would appreciate an escape-hatch to get the value in a particular unit, e.g.

Measure.of(8, furlongs).valueIn(miles) returns numeric 1.

Hi @raoz,

This is possible right now via:

Measure.of(8, furlongs).over(miles).value

Does this solve your use case?

raoz commented

Hi @jscheiny,

Thanks, this does solve it for now, might make a pull request soon to add the valueIn sugar for clarity, if you don't mind.