@44north/unitconverter

The UnitConverter

Usage no npm install needed!

<script type="module">
  import 44northUnitconverter from 'https://cdn.skypack.dev/@44north/unitconverter';
</script>

README

UnitConverter

This module is ment to provide helper methods for testing modules and services.

Install

Log into npm and run one of the following

npm install @44north/unitconverter --save-dev

or

yarn add @44north/unitconverter --dev

Usage

import { TemperatureConverter } from "@44north/unitconverter";

const temp1 = new TemperatureConverter("F", "C").convert(212); // 100
const temp2 = new TemperatureConverter()
    .setFromUnit("F")
    .setToUnit("C")
    .convert(212); // 100
const temp3 = new TemperatureConverter().convert(212, "F", "C"); // 100
const temp4 = TemperatureConverter.convert(212)
    .from("F")
    .to("C"); // 100

Attribution

This module is based of the work of Ben Ng repository convert-units npm module. while functional, its not been maintained or updated in several years.