Skip to content
forked from jmandel/ucum.js

JavaScript library for unitsofmeasure.org (UCUM)

Notifications You must be signed in to change notification settings

fhir-js/ucum.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ucum.js

JavaScript implementation of UCUM (http://unitsofmeasure.org)

Units conversion

var one_inch = ucum.convert(2.54, 'cm', '[in_i]');
console.log(one_inch)

1

Units parsing

var parsed = ucum.parse('km/h');
console.log(parsed);

{ value: 1000, units: { m: 1, h: -1 } }

Units canonicalization

var canonical = ucum.canonicalize('[in_i]/a');
console.log(canonical);

{ value: 8.048774304763354e-10, units: { m: 1, s: -1 } } 

To use in browser

Save and include a <script> tag for dist/ucum.js

To use in Node.js

npm install ucum.js

To build

$ git clone https://github.com/jmandel/ucum.js
$ cd ucum.js
$ npm install
$ make

About

JavaScript library for unitsofmeasure.org (UCUM)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.1%
  • Other 0.9%