Giter Site home page Giter Site logo

namelessw0lf / unit-converter Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 2.0 20 KB

Module to convert units for distances, weights and temperatures!

TypeScript 100.00%
converter units unit convert distance temperature weight distance-calculation distance-measures weights

unit-converter's Introduction

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

unit-converter's People

Contributors

nameless4wolf avatar namelessw0lf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

unit-converter's Issues

Let there be colour!

If you type your codeboxes in the README like this:

//```js
console.log("Let there be Colour")
//```

it will be coloured code: XD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.