Skip to content

How to list the unit type and respective aliases #2985

Answered by josdejong
luzfcb asked this question in Q&A
Discussion options

You must be logged in to vote

You can loop through all units defined in math.Unit.UNITS and filter those that have a base unit MASS, something like:

Object.values(math.Unit.UNITS).filter(unit => unit.base.key === 'MASS')

Note that each of the units can be prefixed too, like milligram and kilogram etc.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by luzfcb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants