Skip to content

2.0.1

Latest
Compare
Choose a tag to compare
@jscheiny jscheiny released this 21 May 02:42
· 5 commits to master since this release
949a286

Breaking changes

  • The Measure.dimension and Measure.dimensionless functions now require a unit system as their first parameter. The Measure.dimension function can no longer arbitrarily produce new dimensions. To add new dimensions, create a new UnitSystem.
  • Changed the way in which unit exponents are represented. Exponents are now numbers instead of strings and units contain every dimension in their unit system even if the exponent is zero.
  • Removed the ability to arbitrarily perform exponentiation on measures. The measure.toThe and Measure.pow functions have been removed.
  • Removed the ability to perform roots of measures. The Measure.sqrt and Measure.cbrt functions have been removed.

New features

  • Introduced the concept of a unit system. Unit systems define a fixed set of dimensions and their corresponding base units. Measures of a given unit system are not assignable to measures of other unit systems. Safe units ships with a default implementation of the SI unit system as SIUnitSystem.
  • Removed the limitations on exponents. Previously, exponents of dimensions had to be between -5 and +5. Now the limit on exponents is much larger and should no longer present any issues.
  • Added a new valueIn method to the Measure class. Calling measure.valueIn(unit) is syntactic sugar for measure.div(unit).value.

Fixes

  • Fixed an issue where measures could be assigned to measures of different unit types if they contained a superset of the other measure's dimensions. In order to fix this, the concept of unit systems was introduced.
  • Fixed incorrect symbols for the joules and watts units.