- Fix package.json so that when using
import, it imports the correct ES module. Thank you @fezproof!
- Add
applyBestPrefixmethod to choose and apply the best prefix for a Unit. Thank you @adrfantini for the contribution.
- Set
exportsinpackage.json, which fixes imports in Node and Deno when usingrequireorimport()
This is an attempt to correctly export types.
- Set
moduleentry point in package.json toes/UnitMath.js - Set
typesin 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.
toStringno longer simplifies units. You must now explicitly callsimplifyfor the unit to be simplified.- Removed
simplifyandsimplifyThresholdoptions. - Removed
definitions.quantitiesanddefinitions.baseQuantities. - Renaned
definitions.unitSystemstodefinitions.systems - Renamed
definitions.prefixestodefinitions.prefixGroups - Each system defined in
definitions.systemsis now just a string array of units assigned to that system. - Removed
autoAddToSystemoption, since it is now much easier to add units to a system. - Customer formatters no longer accept additional user arguments.
toStringno longer simplifies units. The user must now explicitly callsimplifyfor the unit to be simplified.- Removed
simplifyThresholdoption, since units are now only simplified when callingsimplify. - Many updates to the README.
- Many tests had to be altered to reflect the changes to
toStringandsimplify.
- 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
teaspoonandfluidounce
comparenow handles NaNs consistently
- Added
prefixesToChooseFromoption - Bugfix when auto-prefixing negative numbers
splitnow supports custom types
- Fixed unit complexity calculation for deciding whether to simplify units
- Added undocumented second parameter to
convfunction, 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.