1.3.0-rc3 • Published 4 months ago

chem-units v1.3.0-rc3

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
4 months ago

chem-units npm version

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!

1.3.0-rc1

4 months ago

1.3.0-rc3

4 months ago

1.3.0-rc2

4 months ago

1.2.1

6 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.2

10 months ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.6-alpha

1 year ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.5-beta.1

2 years ago

0.0.5-beta

2 years ago

0.0.5-alpha

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.3-beta

2 years ago

0.0.3-alpha

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago