parseQuantity
Function in @sascom/commonjs.
API catalogue · @sascom/commonjs · Function
TypeScript#
function parseQuantityMembers#
| Member | Kind | Description |
|---|---|---|
| parseQuantity | Method | Parses a quantity typed by a user: "60cm", "1,5 m", "5' 6 1/2"", "1200/2", "90°". A comma between two digits is a decimal comma; values of one kind next to … |
parseQuantity#
TypeScript#
parseQuantity(text: string, options?: QuantityOptions): ParsedQuantity | QuantityParseErrorParses a quantity typed by a user: "60cm", "1,5 m", "5' 6 1/2"", "1200/2", "90°". A comma between two digits is a decimal comma; values of one kind next to each other add up ("1 m 20 cm"); + - * / and brackets work.
Parameters#
| Name | Type | Description |
|---|---|---|
text |
string |
|
options |
QuantityOptions |