Quantity Class

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

Last Updated: 16 April, 2024