Parser Class

Beta  

A Parser class that is used to break a string that represents a quantity value into tokens.

Methods

Name Description
constructor(): Parser    
createUnitConversionSpecs(unitsProvider: UnitsProvider, outUnitName: string, potentialParseUnits: PotentialParseUnit[]): Promise<UnitConversionSpec[]> Static Async Method used to create an array of UnitConversionSpec entries that can be used in synchronous calls to parse units.  
createUnitConversionSpecsForUnit(unitsProvider: UnitsProvider, outUnit: UnitProps): Promise<UnitConversionSpec[]> Static Async Method used to create an array of UnitConversionSpec entries that can be used in synchronous calls to parse units.  
isParseError(item: QuantityParseResult): item is ParseQuantityError Static    
isParsedQuantity(item: QuantityParseResult): item is ParsedQuantity Static    
parseIntoQuantity(inString: string, format: Format, unitsProvider: UnitsProvider): Promise<QuantityProps> Static Async method to generate a Quantity given a string that represents a quantity value and likely a unit label.  
parseQuantitySpecification(quantitySpecification: string, format: Format): ParseToken[] Static Parse the quantity string and return and array of ParseTokens that represent the component invariant values and unit labels.  
parseQuantityString(inString: string, parserSpec: ParserSpec): QuantityParseResult Static Method to generate a Quantity given a string that represents a quantity value.  
parseToQuantityValue(inString: string, format: Format, unitsConversions: UnitConversionSpec[]): QuantityParseResult Static Method to generate a Quantity given a string that represents a quantity value and likely a unit label.  

Defined in

Last Updated: 11 June, 2024