UNPKG

conversion-package

Version:

In this package I created 4 functions which know how to convert

51 lines (41 loc) 1.32 kB
# Conversion-Package ## Introduction: In this package there are conversion functions written in javascript. The functions can convert "unit of length" and also "Scale of temperature". The functions perform conversions based on an argument that the user enters. It is written in a short and efficient way. ## arguments: - "cm" = The argument input will be `inch` and the output will be `centimeter`. - "inch" = The argument input will be `centimeter` and the output will be `inch`. - "Tc" = The argument input will be `fahrenheit` and the output will be `celsius`. - "Tf" = The argument input will be `celsius` and the output will be `fahrenheit`. ## Example: ##### "Converts centimeter to inch": ```bash function cm_to_inch(cm){ let inch = cm / 2.54; console.log(`The result is:`); console.log(`cm: ${cm} ===` + ` inch: ${inch}`); } cm_to_inch(13); // The result is: cm: 13 === inch: 5.118110236220472 ``` ## Exports: ```bash module.exports = { inch_to_cm, cm_to_inch, fahrenheit_to_celsius, celsius_to_fahrenheit } ``` ## How to use: 1. installing - ```bash npm install conversion-package ``` 2. using - ```bash const package = require('conversion-package'); package.name of the function(appropriate argument); ```