Skip to content

Releases: jscheiny/safe-units

2.0.1

21 May 02:42
949a286
Compare
Choose a tag to compare

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.

1.1.0

08 Nov 22:06
2ce9f13
Compare
Choose a tag to compare
v1.1.0 (#149)