- Fix package.json so that when using
import
, it imports the correct ES module. Thank you @fezproof!
- Add
applyBestPrefix
method to choose and apply the best prefix for a Unit. Thank you @adrfantini for the contribution.
- Set
exports
inpackage.json
, which fixes imports in Node and Deno when usingrequire
orimport()
This is an attempt to correctly export types.
- Set
module
entry point in package.json toes/UnitMath.js
- Set
types
in package.json toes/UnitMath.d.ts
V1 is a major rewrite of UnitMath in TypeScript. While most of the API remains the same, V1 does introduce several breaking changes from v0.8.7. See Migrating to v1 for details.
toString
no longer simplifies units. You must now explicitly callsimplify
for the unit to be simplified.- Removed
simplify
andsimplifyThreshold
options. - Removed
definitions.quantities
anddefinitions.baseQuantities
. - Renaned
definitions.unitSystems
todefinitions.systems
- Renamed
definitions.prefixes
todefinitions.prefixGroups
- Each system defined in
definitions.systems
is now just a string array of units assigned to that system. - Removed
autoAddToSystem
option, since it is now much easier to add units to a system. - Customer formatters no longer accept additional user arguments.
toString
no longer simplifies units. The user must now explicitly callsimplify
for the unit to be simplified.- Removed
simplifyThreshold
option, since units are now only simplified when callingsimplify
. - Many updates to the README.
- Many tests had to be altered to reflect the changes to
toString
andsimplify
.
- Parse strings
NaN
,Infinity
, and-Infinity
- Convert to TypeScript
- Removed concept of "quantities" and "base quantities"
- Simplified how systems are defined and used in formatting
- Simpler way to define units
- Renamed many variables and API functions to make their meaning less ambiguous
- Updated README.md
- Standardized on US customary fluid volumes
- Corrected values for
teaspoon
andfluidounce
compare
now handles NaNs consistently
- Added
prefixesToChooseFrom
option - Bugfix when auto-prefixing negative numbers
split
now supports custom types
- Fixed unit complexity calculation for deciding whether to simplify units
- Added undocumented second parameter to
conv
function, which could be removed at any time
- Format function can now be used with number or custom types
- Now supports passing parameters to custom format function
- Added
getValue
,getNormalizedValue
, andsetNormalizedValue
- Added format option for custom types
- Added compare
- Implement valueOf()
- Added lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual
- Added setValue
- Fixed bug with custom type formatting
- Fixed candela unit definition
- Added split
- Better support for parsing of custom types
- Added abs
- Basic functionality with custom types (tested with Decimal.js, some features may not work)
- Added numerous tests to improve test coverage
- Removed some unnecessary statements and branches
- Minor bug fixes
- Updated README
- Major refactoring of UnitStore.js to simplify the units definitions
- Custom units now work with config options
- Added code coverage (but doesn't seem to be instrumenting all the files yet)
- This patch actually includes the built files (I hope).
- First public release of UnitMath.
- README is mostly up-to-date. Some of the API has not yet been implemented.