1.1.0 • Published 18 days ago

chem-units v1.1.0

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
18 days ago

chem-units npm version

chem-units is a JavaScript library for converting between different units of measurement commonly used in chemistry.

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!

1.1.0

18 days ago

1.0.3

23 days ago

1.0.2

25 days ago

1.0.1

1 month ago

1.0.0

1 month ago

0.0.6-alpha

2 months ago

0.0.6

2 months ago

0.0.5

9 months ago

0.0.5-beta.1

9 months ago

0.0.5-beta

9 months ago

0.0.5-alpha

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.3-beta

9 months ago

0.0.3-alpha

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago