Module to convert units for distances, weights and temperatures!

Overview

Unit Converter (Distance, Temperature, Weights)

Every unit you can see in this file can be transformed into any of the other units. The Calculator works in any direction. Call the according method and give the following parameters in the correct order:

  1. Value you want to transform
  2. Unit of this value
  3. The unit you want to change the value to.

Please always use lowercase strings!

Distance-Converter

Usage example for your code

import { DistanceUnitChanger } from "https://deno.land/x/unit_converter/mod.ts";

var meter = 42
//                                          Value | Old Unit | New Unit
var kilometer = DistanceUnitChanger.convert(meter, "meter", "kilometer")
var centimeter = DistanceUnitChanger.convert(meter, "meter", "centimeter")
var millimeter = DistanceUnitChanger.convert(meter, "meter", "millimeter")
var inches = DistanceUnitChanger.convert(meter, "meter", "inches")
var miles = DistanceUnitChanger.convert(meter, "meter", "miles")
var nautic_miles = DistanceUnitChanger.convert(meter, "meter", "nautic_miles")
var yards = DistanceUnitChanger.convert(meter, "meter", "yards")
var foot = DistanceUnitChanger.convert(meter, "meter", "foot")

Weight-Converter

Usage example for your code

import { WeightUnitChanger } from "https://deno.land/x/unit_converter/mod.ts";

var kilogram = 42
//                                    Value  |  Old Unit  |  New Unit
var gram = WeightUnitChanger.convert(kilogram, "kilogram", "gram")
var tonne = WeightUnitChanger.convert(kilogram, "kilogram", "tonne")
var ounce = WeightUnitChanger.convert(kilogram, "kilogram", "ounce")
var pound = WeightUnitChanger.convert(kilogram, "kilogram", "pound")

Temperature-Converter

Usage example for your code

import { TemperatureUnitChanger } from "https://deno.land/x/unit_converter/mod.ts";

var celsius = 42
//                                              Value  |   Old Unit  | New Unit
var fahrenheit = TemperatureUnitChanger.convert(celsius, "celsius", "fahrenheit")
var kelvin = TemperatureUnitChanger.convert(celsius, "celsius", "kelvin")

Test it via command line

deno run --allow-net https://deno.land/x/unit_converter/test-it.ts
You might also like...

Deno module to convert fiat currencies with fetched API from fixer.io

Usage example Deno module to convert fiat money currencies with initial fetched API from fixer.io There are two different modes for this module. Mode

Jan 29, 2022

Fintoc.js ES Module - Use the Fintoc widget as an ES module

Fintoc.js ES Module Use the Fintoc widget as an ES module. Installation Install using npm! (or your favourite package manager) # Using npm npm install

May 13, 2022

Template Repository for making your own budder Module. CORE is not included, this is just for the module.

A quick copy of the "How to make your own module" section Check out the official budderAPI repository Template Repository for making your own budder M

Apr 3, 2022

Userland module that implements the module path mapping that Node.js does with "exports" in package.json

exports-map Userland module that implements the module path mapping that Node.js does with "exports" in package.json npm install exports-map Usage co

May 31, 2022

A module federation SDK which is unrelated to tool chain for module consumer.

A module federation SDK which is unrelated to tool chain for module consumer.

hel-micro, 模块联邦sdk化,免构建、热更新、工具链无关的微模块方案 Demo hel-loadash codesandbox hel-loadash git Why hel-micro 如何使用远程模块 仅需要一句npm命令即可载入远程模块,查看下面例子线上示例 1 安装hel-micr

Jan 3, 2023

Mercury: easily convert Python notebook to web app and share with others

Mercury: easily convert Python notebook to web app and share with others

Mercury Share your Python notebooks with others Easily convert your Python notebooks into interactive web apps by adding parameters in YAML. Simply ad

Dec 30, 2022

Convert and Calculate by RPN for typescript.

Coaca.ts: Convert and Calculate by RPN for typescript 注意点 まずそもそも、typescriptはサーバサイドで使用されるべき言語です。一応typescript4.5以降の機能を用いていますが、typescriptの本来の使い方を超越してます。ご

Aug 24, 2022

When pasting screenshots into obsidian notes, convert the images to jpeg and compress them

When pasting screenshots into obsidian notes, convert the images to jpeg and compress them

obsidian-paste-png-to-jpeg This plugin is inspired by obsidian-paste-image-rename, obsidian-paste-image-rename can be used when inserting images renam

Nov 15, 2022
Releases(v1.1.4)
Owner
Niklas Koch
What does a drowning data scientist say? - "I'm syncing"
Niklas Koch
Svelte component to display time distances in a human readable format.

Time Distance Display time distances in a human readable format. Based on date-fns Updates every 60 seconds View demo Usage Install package: pnpm i -D

Joshua Nussbaum 8 Nov 2, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

Snyk Labs 57 Dec 28, 2022
A simple calculator for how many units of insulin to take with a meal depending on current and target blood sugar levels.

Insulin-Calculator One of my first programs, made to try building javascript-read HTML forms. A simple calculator for how many units of insulin to tak

Athena 1 Dec 26, 2021
The ManageYourCompany 📈 project is a project that creates, deletes, updates companies, units and assets.

The ManageYourCompany ?? project is a project that creates, deletes, updates companies, units and assets. The rule is that every company has several units and the units have several assets, these assets are machines with several fields: Name, status, person in charge, image, among others... This is a project in order to exercise my Backend skills with NodeJs and front with react.

Bruno da Silva Leite 2 Feb 9, 2022
Explore units, stats and more

AoE 4 Explorer An useful visualization and UI to explore units, their stats and abilities and all possible upgrades and technologies for Age Of Empire

AoE4 World 20 Dec 8, 2022
A dedicated desktop app that enables you to move items in and out of storage units in CSGO.

CASEMOVE Casemove is an open-source desktop application that helps you easily move items out of and into Storage Units in Counter-Strike: Global Offen

null 161 Dec 24, 2022
Firefox plugin to automatically translate ° Fahrenheit and size measurements into european units

Eurofox ???? ?? ?? Firefox plugin to automatically translate ° Fahrenheit, weights, speed and size measurements into european units. To see the origin

Inga Feick 5 Oct 16, 2022