4.0.4 • Published 6 months ago

d4m-unit-converter v4.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago
Author: Chris Johannesson - cj223bc - info@chrisjohannesson.com

*** Please note that version 4 is a breaking release from version 2 and 3

Name: d4m-unit-converter

Unit Converter

This npm package allows for easy conversion between metric and imperial units, as well as between different temperature scales, through an intuitive interface.

Supported Units

Metric1DUnits: kilometer (km), meter (m), decimeter (dm), centimeter (cm) Imperial1DUnits: mile, yard, foot, inch, mil TemperatureUnits: Celsius, Fahrenheit, Kelvin

Note:

Project in course 1DV610 at Linnaeus University, Kalmar, Sweden. Fall semester 2023

License

ISC license

Version: >= ES6 Type: ES module

Usage:

Start with installing the package into your project

npm install --save d4m-unit-converter
# or
yarn add d4m-unit-converter

A typical usage would be

# for conversions between metric and imperial measures
import {UnitConverter, Metric1DUnits, Imperial1DUnits} from 'd4m-unit-converter'
const unitconverter = new UnitConverter()
# for metric to imperial conversions
const converter = unitconverter.MetricToImperial
const result = converter.convert(length, metricUnit, imperialUnit)
# for imperial to metric conversions
const converter = unitconverter.ImperialToMetric
const result = converter.convert(length, imperialUnit, metricUnit)

# for temperature conversions
import {UnitConverter, TemperatureUnits}
const unitconverter = new UnitCOnverter()
const converter = unitconverter.TemperatureConverter
const result = converter.convert(fromValue, fromUnit, toUnit)

Create an instance of the UnitConverter and from there you can chose which type of converter you want to use as illustrated above.

Test app

4.0.4

6 months ago

4.0.3

7 months ago

4.0.2

7 months ago

4.0.1

7 months ago

2.1.9

7 months ago

2.1.8

7 months ago

2.1.7

7 months ago

2.1.6

7 months ago

2.1.5

7 months ago

2.1.4

7 months ago

2.1.3

7 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.1.0

7 months ago

2.0.2

7 months ago

2.0.1

7 months ago

2.0.0

7 months ago