Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/twlite/temperature
Simple package for deno to convert temperature.
https://github.com/twlite/temperature
Last synced: about 1 month ago
JSON representation
Simple package for deno to convert temperature.
- Host: GitHub
- URL: https://github.com/twlite/temperature
- Owner: twlite
- Created: 2020-07-29T14:56:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-04T09:37:14.000Z (over 4 years ago)
- Last Synced: 2024-09-20T00:28:32.943Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Temperature
Simple package for deno to convert temperature.> **[Click here for nodejs version](https://npmjs.com/package/node-temperature-converter)**
# Features
- simple
- fast
- easy to use# Example
```ts
import Converter from "https://raw.githubusercontent.com/Snowflake107/temperature/master/mod.ts";// celsius
const celsius = new Converter.Celsius(35);const obc = {
name: "Celsius",
deg: celsius.degrees,
fah: celsius.toFahrenheit(),
kel: celsius.toKelvin(),
str: celsius.toString(),
};
console.table(obc);/*
Expected Output:
┌───────┬───────────┐
│ (idx) │ Values │
├───────┼───────────┤
│ name │ "Celsius" │
│ deg │ 35 │
│ fah │ 95 │
│ kel │ 308.15 │
│ str │ "35°C" │
└───────┴───────────┘
*/// fahrenheit
const fahrenheit = new Converter.Fahrenheit(95);const obf = {
name: "Fahrenheit",
deg: fahrenheit.degrees,
cel: fahrenheit.toCelsius(),
kel: fahrenheit.toKelvin(),
str: fahrenheit.toString(),
};
console.table(obf);/*
Expected Output:
┌───────┬──────────────┐
│ (idx) │ Values │
├───────┼──────────────┤
│ name │ "Fahrenheit" │
│ deg │ 95 │
│ cel │ 35 │
│ kel │ 308.15 │
│ str │ "95°F" │
└───────┴──────────────┘
*/// kelvin
const kelvin = new Converter.Kelvin(308.15);const obk = {
name: "Kelvin",
deg: kelvin.degrees,
cel: kelvin.toCelsius(),
fah: kelvin.toFahrenheit(),
str: kelvin.toString(),
};
console.table(obk);/*
Expected Output:
┌───────┬───────────┐
│ (idx) │ Values │
├───────┼───────────┤
│ name │ "Kelvin" │
│ deg │ 308.15 │
│ cel │ 35 │
│ fah │ 95 │
│ str │ "308.15K" │
└───────┴───────────┘
*/```
# Running (No permissions required)
```sh
deno run
```