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. | |
| FormatSpecHandle | A cacheable handle to formatting and parsing specs for a specific KoQ and persistence unit. | |
| 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. | |
| FormattingReadyCollector | Collects async work from formatting providers during the pre-ready phase. | |
| 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. | |
| RatioFormatType | The format type for the numbers within a ratio. | |
| 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. | |
| parseRatioFormatType | ||
| parseRatioType | ||
| parseScientificType | ||
| parseShowSignOption | ||
| scientificTypeToString | Deprecated | |
| showSignOptionToString | Deprecated |
Interfaces
| Name | Description | |
|---|---|---|
| AddFormattingSpecArgs | Arguments for registering a formatting spec entry. | |
| 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. | |
| FormatCompositeProps | Defines the units that make up a composite format and their display properties. | |
| FormatDefinition | An extension of FormatProps to help identify formats. | |
| FormatProps | This interface defines the persistence format for describing the formatting of quantity values. | |
| FormatsChangedArgs | Argument for onFormatsChanged | |
| FormatsProvider | This interface is implemented by a class that would provide formats for use in formatting quantities. | |
| FormattingSpecArgs | Arguments for looking up a formatting spec entry. | |
| FormattingSpecEntry | Entries returned when looking up specs from the format registry. | |
| FormattingSpecProvider | Minimal contract required by FormatSpecHandle to look up specs and subscribe to reloads. | |
| FormatUnitSpec | Defines a unit specification with a name and optional label override. | |
| MutableFormatsProvider | This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities. | |
| 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. | |
| ResolvedFormatUnitSpec | A resolved FormatUnitSpec with the unit name replaced with the resolved UnitProps. | |
| 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 | |
| ResolvedFormatCompositeProps | A FormatCompositeProps with unit names replaced with JSON representations of those units. | |
| ResolvedFormatProps | A FormatProps with all the references to units replaced with JSON representations of those units. | |
| UnitSystemKey | Identifies a user-facing unit system preference group. |
Last Updated: 15 April, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.