Open lpatiny opened 3 years ago
In order to 'normalize' the user entered quantities in a database I create a JSON that contains 2 properties:
I would like to have a code like:
const qty = Qty.parse('100 cm^2'); return { SI: qty.baseScalar, unit: qty.getUnit(), // this would contain 'cm^2' };
I could not find a way to achieve this getUnit with js-quantities. Is this possible ?
getUnit
Isn't Qty(123, 'cm2').units() enough?
Qty(123, 'cm2').units()
Otherwise you can play around with toBase() maybe?
toBase()
In order to 'normalize' the user entered quantities in a database I create a JSON that contains 2 properties:
I would like to have a code like:
I could not find a way to achieve this
getUnit
with js-quantities. Is this possible ?