UNPKG

@khanisak/temperature-converter

Version:

Javascript lightweight library to manipulate temperature units

52 lines (51 loc) 2.49 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Romer = void 0; var Celcius_1 = require("./Celcius"); var Delisle_1 = require("./Delisle"); var Fahrenheit_1 = require("./Fahrenheit"); var Kelvin_1 = require("./Kelvin"); var Newton_1 = require("./Newton"); var Rankine_1 = require("./Rankine"); var Reamur_1 = require("./Reamur"); var Temperature_1 = __importDefault(require("./Temperature")); var Romer = /** @class */ (function (_super) { __extends(Romer, _super); function Romer(value) { var _this = _super.call(this, value) || this; _this.toCelcius = function () { return new Celcius_1.Celcius((_this.value - 7.5) * 40 / 21); }; _this.toDelisle = function () { return new Delisle_1.Delisle((60 - _this.value) * 20 / 7); }; _this.toFahrenheit = function () { return new Fahrenheit_1.Fahrenheit((_this.value - 7.5) * 24 / 7 + 32); }; _this.toKelvin = function () { return new Kelvin_1.Kelvin((_this.value - 7.5) * 40 / 21 + 273.15); }; _this.toNewton = function () { return new Newton_1.Newton((_this.value - 7.5) * 22 / 35); }; _this.toRankine = function () { return new Rankine_1.Rankine((_this.value - 7.5) * 24 / 7 + 491.67); }; _this.toReamur = function () { return new Reamur_1.Reamur((_this.value - 7.5) * 32 / 21); }; _this.toRomer = function () { return _this; }; _this.unit = Romer.unit; return _this; } Romer.unit = { name: 'Rømer', code: '°Rø' }; return Romer; }(Temperature_1.default)); exports.Romer = Romer;