Unit of Measure Conversion Library

前端 未结 8 2152
面向向阳花
面向向阳花 2020-12-07 15:15

What is the best/most elegant way to abstract out the conversion of units of measures in the client, based on a user-preferred unit of measure setting?

For example,

8条回答
  •  -上瘾入骨i
    2020-12-07 15:35

    Inspired by many posts regarding this subject and the simplicity and smallness of MomentJs i have started work on this:

    MeasurementJs

    It doesn't include all of the mentioned conversions yet, but you can easily extend the DEFINITIONS array and MeasurementJs.Units.* objects for any possible conversion you like.

提交回复
热议问题