convert-calc

1.1.1 • Public • Published

convert-calc

A Standard Converter to convert values from one unit of measurement to another. This package gives accurate results tailored to your specific needs. It can reduce your effort of manually remembering and writing formula or conversion factor to convert values among different units.

Table of Contents

  • Install
  • Usage
  • Maintainer
  • Contributing
  • License

Install

This generator requires node and npm.

You can install it globally by running:

npm install -g convert-calc

You can install it locally by running:

npm install convert-calc

Usage

First of all import or require the package after installation.

Imported 'convert' function from the package.

Length Converter

convert('length', fromUnit, toUnit, value)

Mass Converter

convert('mass', fromUnit, toUnit, value)

Time Converter

convert('time', fromUnit, toUnit, value)

Area Converter

convert('area', fromUnit, toUnit, value)

Data Converter

convert('data', fromUnit, toUnit, value)

Speed Converter

convert('speed', fromUnit, toUnit, value)

Volume Converter

convert('volume', fromUnit, toUnit, value)

Temperatur Converter

convert('temp', fromUnit, toUnit, value)

Using BMI Calculator

Import 'calculateBMI' function from the package.
calculateBMI(height, heigthUnit, weight, weightUnit)

Values to be placed at units

You have to place abbreviation of units in place of fromUnit, toUnit, heigthUnit, weightUnit.

Length = [
    { unit: 'millimeter', abbreviation: 'mm' },
    { unit: 'centimeter', abbreviation: 'cm' },
    { unit: 'decimeter', abbreviation: 'dm' },
    { unit: 'meter', abbreviation: 'm' },
    { unit: 'decameter', abbreviation: 'dam' },
    { unit: 'hectometer', abbreviation: 'hm' },
    { unit: 'kilometer', abbreviation: 'km' },
    { unit: 'inch', abbreviation: 'in' },
    { unit: 'foot', abbreviation: 'ft' },
    { unit: 'mile', abbreviation: 'mi' },
    { unit: 'yard', abbreviation: 'yd' },
    { unit: 'light year', abbreviation: 'ly' }
];
Mass = [
    { unit: 'milligram', abbreviation: 'mg' },
    { unit: 'centigram', abbreviation: 'cg' },
    { unit: 'decigram', abbreviation: 'dg' },
    { unit: 'gram', abbreviation: 'g' },
    { unit: 'decagram', abbreviation: 'dag' },
    { unit: 'hectogram', abbreviation: 'hg' },
    { unit: 'kilogram', abbreviation: 'kg' },
    { unit: 'metric ton', abbreviation: 'mt' },
    { unit: 'quintal', abbreviation: 'q' },
    { unit: 'pound', abbreviation: 'lb' },
    { unit: 'ounce', abbreviation: 'oz' }
];
Time = [
    { unit: 'second', abbreviation: 'sec' },
    { unit: 'minute', abbreviation: 'min' },
    { unit: 'hour', abbreviation: 'h' },
    { unit: 'day', abbreviation: 'day' },
    { unit: 'week', abbreviation: 'week' },
    { unit: 'year', abbreviation: 'year' },
    { unit: 'milliseconds', abbreviation: 'ms' }
];
Area = [
    { unit: 'square kilometer', abbreviation: 'km2' },
    { unit: 'hectare', abbreviation: 'ha' },
    { unit: 'square meter', abbreviation: 'm2' },
    { unit: 'square decimeter', abbreviation: 'dm2' },
    { unit: 'square centimeter', abbreviation: 'cm2' },
    { unit: 'square millimeter', abbreviation: 'mm2' },
    { unit: 'acre', abbreviation: 'ac' },
    { unit: 'square mile', abbreviation: 'mile2' },
    { unit: 'square yard', abbreviation: 'ac' },
    { unit: 'square foot', abbreviation: 'ft2' },
    { unit: 'square inch', abbreviation: 'in2' }
];
Data = [
    { unit: 'byte', abbreviation: 'B' },
    { unit: 'kilobyte', abbreviation: 'KB' },
    { unit: 'megabyte', abbreviation: 'MB' },
    { unit: 'gigabyte', abbreviation: 'GB' },
    { unit: 'terabyte', abbreviation: 'TB' },
    { unit: 'petabyte', abbreviation: 'PB' }
];
Speed = [
    { unit: 'lightspeed', abbreviation: 'c' },
    { unit: 'mach', abbreviation: 'ma' },
    { unit: 'meter/sec', abbreviation: 'm/s' },
    { unit: 'kilometer/hour', abbreviation: 'km/h' },
    { unit: 'kilometer/sec', abbreviation: 'km/s' },
    { unit: 'knot', abbreviation: 'kn' },
    { unit: 'mile/hour', abbreviation: 'mph' },
    { unit: 'foot/sec', abbreviation: 'fps' },
    { unit: 'inch/sec', abbreviation: 'ips' },
];
volume = [
    { unit: 'cubic meter', abbreviation: 'm3' },
    { unit: 'cubic decimeter', abbreviation: 'dm3' },
    { unit: 'cubic centimeter', abbreviation: 'cm3' },
    { unit: 'cubic millimeter', abbreviation: 'mm3' },
    { unit: 'hectoliter', abbreviation: 'hl' },
    { unit: 'liter', abbreviation: 'l' },
    { unit: 'deciliter', abbreviation: 'dl' },
    { unit: 'centiliter', abbreviation: 'cl' },
    { unit: 'milliliter', abbreviation: 'ml' },
    { unit: 'cubic foot', abbreviation: 'ft3' },
    { unit: 'cubic inch', abbreviation: 'in3' },
    { unit: 'cubic yard', abbreviation: 'yd3' },
    { unit: 'acre-foot', abbreviation: 'af3' }
];
Temp = [
    { unit: 'celsius', abbreviation: 'C' },
    { unit: 'fahrenheit', abbreviation: 'F' },
    { unit: 'kelvin', abbreviation: 'K' },
    { unit: 'rankin', abbreviation: 'R' }
];

Maintainer

npm: @anandsyadav
Linkedin: ANAND YADAV
GitHub: ANANDSYADAV

Contributing

Feel free to contribute and fix bugs 🙂

License

⚖️ Apache-2.0 license

Package Sidebar

Install

npm i convert-calc

Weekly Downloads

4

Version

1.1.1

License

Apache-2.0

Unpacked Size

8.69 kB

Total Files

4

Last publish

Collaborators

  • anandsyadav