chem-units v1.3.0-rc3
chem-units 
chem-units
is a JavaScript library for converting between different units of measurement commonly used in chemistry.
See Supported Units for System Defined Field for the complete list of supported units.
Installation
You can install chem-units
using npm:
npm install chem-units
or yarn:
yarn add chem-units
Usage
To use chem-units
, simply import the library and call the unitConversion
function with the unit name, the value to be converted, and the target unit:
import * as ChemUnits from 'chem-units';
const type = 'temperature'; // the type of unit
const targetUnit = 'F'; // converts from Celsius to Fahrenheit
const value = '32'; // value
const result = ChemUnits.unitConversion(type, targetUnit, value);
console.log(result); // 89.6
chem-units
supports a wide range of units for mass, volume, temperature, and pressure. For a full list of supported units, call:
console.log(si); // a list of supported unit types and units
API
unitConversion(unit, targetUnit, value)
Converts a value from one unit to another.
type
- The unit type.targetUnit
- The unit to convert the value to.value
- The value to be converted.
Returns the converted value.
genUnits(type)
Returns a list of units for a given type.
type
- The type of units to return. Valid values are'mass'
,'volume'
,'temperature'
, and'pressure'
.
Returns an array of unit names.
Contributing
chem-units
is utilized to offer commonly used units of measurement in chemistry. If you don't find a suitable unit for your application, please contact the Maintainer. We also welcome pull requests!
License
Licensed under the AGPL-3.0 license.
Maintainer
This project is maintained by:
Feel free to reach out if you have any questions or suggestions!
4 months ago
4 months ago
4 months ago
6 months ago
10 months ago
10 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago