Skip to content

seniverse/ucumex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ucumex

A elixir lib according to THE UNIFIED CODE FOR UNITS OF MEASURE to convert unit.

Note!

  • Comment is not Supported
  • Special Units are not Supported Except Fahrenheit Degree and Celsius Degree

Examples

{:ok, op} = Ucumex.convertor("km", "m")

op.(3) # -> 3.0e3
# "[degRe]" is special unit
Ucumex.convertor("km", "[degRe]")

** (NotImplementedError) handler is not implemented for this special unit.
    (ucumex) lib/ucumex.ex:390: Ucumex.to_basic_units/1
    (ucumex) lib/ucumex.ex:48: Ucumex.to_bin_op/2
    (ucumex) lib/ucumex.ex:24: Ucumex.unit_to_std/1
    (ucumex) lib/ucumex.ex:17: Ucumex.convertor/2
{:error, :unit_not_match} = Ucumex.convertor("km", "L")