Quantity

Classes, Interfaces, and definitions used to format and parse quantity values.

Classes

Name Description  
BadUnit This class is a convenience class that can be returned when a valid Unit cannot be determined.  
BaseFormat A base Format class with shared properties and functionality between quantity and ecschema-metadata Format classes  
BasicUnit This class provides basic implementation of UnitProps interface.  
Format A class used to define the specifications for formatting quantity values.  
Formatter A helper class that contains methods used to format quantity values based on a format that are defined via the Format class.  
FormatterSpec A class that contains both formatting information and the conversion factors necessary to convert from an input unit to the units specified in the format.  
Parser A Parser class that is used to break a string that represents a quantity value into tokens.  
ParserSpec A ParserSpec holds information needed to parse a string into a quantity synchronously.  
Quantity The Quantity class is convenient container to specify both the magnitude and unit of a quantity.  
QuantityError The error type thrown by this module.  

Enumerations

Name Description  
DecimalPrecision Precision for Decimal, Scientific, and Station formatted value types.  
FormatTraits  
FormatType Supported format types  
FractionalPrecision Precision for Fractional formatted value types.  
ParseError Possible parser errors  
QuantityStatus Status codes used during Quantity parsing and formatting processing.  
RatioType required if type is ratio  
ScientificType required if type is scientific  
ShowSignOption Determines how the sign of values are displayed  
UnitConversionInvert Indicates the way in which unit values are inverted during conversion  

Global Functions

Name Description  
formatTraitsToArray  
formatTypeToString Deprecated
getTraitString  
isCustomFormatProps  
parseDecimalPrecision  
parseFormatTrait  
parseFormatType  
parseFractionalPrecision validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision  
parsePrecision validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision.  
parseRatioType  
parseScientificType  
parseShowSignOption  
scientificTypeToString Deprecated
showSignOptionToString Deprecated

Interfaces

Name Description  
AlternateUnitLabelsProvider This interface allows a provider to be specified that will define an array of alternate labels for a specific unit.  
CloneOptions CloneOptions that define modifications that can be made during the cloning of a Format.  
CloneUnit CloneFormat defines unit and label specification if primary unit is to be set during clone.  
CustomFormatProps This interface is used when supporting Custom Formatters that need more than the standard set of properties.  
FormatProps This interface defines the persistence format for describing the formatting of quantity values.  
ParsedQuantity Successful result from parseToQuantityValue or parseToQuantityValue.  
ParseQuantityError Parse error result from parseToQuantityValue or parseToQuantityValue.  
PotentialParseUnit Interface that defines potential parse units that may be found in user's string input of a quantity value.  
QuantityProps This interface defines the required properties of a Quantity.  
UnitConversionProps This interface defines the properties required to convert a quantity value from one unit to another such as from meters to feet  
UnitConversionSpec Interface that defines how to convert between a specific unit an another in synchronous formatting or parsing processing.  
UnitProps This interface provides basic information about a Unit that is return from a UnitProvider.  
UnitsProvider This interface is implemented by the class that is responsible for locating units by name or label and providing conversion values between units.  

Type Aliases

Name Description  
QuantityParseResult Defines Results of parsing a string input by a user into its desired value type  
UnitSystemKey Used to uniquely identify a unit system.  

Last Updated: 13 November, 2024