Quantity Class @beta
The Quantity class is convenient container to specify both the magnitude and unit of a quantity. This class is commonly returned as the result of parsing a string that represents a quantity.
Implements
Methods
| Name | Description | |
|---|---|---|
| constructor(unit?: UnitProps, magnitude?: number): Quantity | Constructor. | |
| convertTo(toUnit: UnitProps, conversion: UnitConversionProps): undefined | Quantity | Convert a Quantity to the specified unit given the UnitConversion. | 
Properties
| Name | Type | Description | |
|---|---|---|---|
| _isValid Protected | boolean | ||
| _magnitude Protected | number | ||
| _unit Protected | UnitProps | ||
| isValid Accessor ReadOnly | boolean | ||
| magnitude Accessor ReadOnly | number | ||
| unit Accessor ReadOnly | UnitProps | 
Defined in
- quantity/src/Quantity.ts Line 30
Last Updated: 24 June, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.