parseUnit
API / publicodes / parseUnit
function parseUnit(string, getUnitKey): Unit
Experimental
Parse a unit string into a Unit object
Parameters
Parameter | Type | Description |
---|---|---|
string | string | The unit string to parse |
getUnitKey | getUnitKey | - |
Returns
The parsed unit object
Example
parseUnit('m/s2')
// returns { numerators: ['m'], denominators: ['s', 's'] }