unique-temperature-converter
v1.0.0
Published
A simple temperature converter npm package in ES6 JavaScript that supports both import and require
Downloads
10
Maintainers
Readme
Temperature Converter
A simple npm package that converts temperatures between Celsius, Fahrenheit, and Kelvin. The package supports both ES6 Modules (import/export
) and CommonJS (require/module.exports
), making it versatile for different environments.
Usage
For ES6 Modules:
import { celsiusToFahrenheit, fahrenheitToCelsius, celsiusToKelvin, kelvinToCelsius } from 'temperature-converter';
console.log(celsiusToFahrenheit(0)); // Output: 32 console.log(fahrenheitToCelsius(32)); // Output: 0 console.log(celsiusToKelvin(0)); // Output: 273.15 console.log(kelvinToCelsius(273.15)); // Output: 0
For CommonJS:
const { celsiusToFahrenheit, fahrenheitToCelsius, celsiusToKelvin, kelvinToCelsius } = require('temperature-converter');
console.log(celsiusToFahrenheit(0)); // Output: 32 console.log(fahrenheitToCelsius(32)); // Output: 0 console.log(celsiusToKelvin(0)); // Output: 273.15 console.log(kelvinToCelsius(273.15)); // Output: 0
Available Functions
- celsiusToFahrenheit(celsius) - Converts Celsius to Fahrenheit.
- fahrenheitToCelsius(fahrenheit) - Converts Fahrenheit to Celsius.
- celsiusToKelvin(celsius) - Converts Celsius to Kelvin.
- kelvinToCelsius(kelvin) - Converts Kelvin to Celsius.
- fahrenheitToKelvin(fahrenheit) - Converts Fahrenheit to Kelvin.
- kelvinToFahrenheit(kelvin) - Converts Kelvin to Fahrenheit.
Contributing
Feel free to open an issue or submit a pull request if you'd like to contribute to this project.
Author
Showbart98 Website: diego-araujo.com