JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q18508F
  • License MIT

A module to convert temperature units.

Package Exports

  • @hugoalh/temperature

Readme

Temperature (NodeJS)

Temperature.NodeJS GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade License

Release Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

πŸ“ Description

A NodeJS module to convert temperature units.

Units of temperature are from Wikipedia - Conversion of scales of temperature.

Unit Symbol Symbol Lowercase Name Name Lowercase
Kelvin [SI] K k Kelvin kelvin
Celsius C c Celsius celsius
Delisle De de Delisle delisle
Fahrenheit F f Fahrenheit fahrenheit
Rankine R r Rankine rankine
RΓ©aumur Re re Reaumur reaumur
RΓΈmer Ro ro Roemer, Romer roemer, romer
Sir Isaac Newton's degree of temperature (Newton) N n Newton newton

πŸ“‹ Note

  • Degree symbol (Β°) is not used in here.
  • In order to fulfill the JavaScript namespace naming requirement, some characters are replaced (e.g.: Γ© to e, ΓΈ to o).
  • This module uses the built in JavaScript Number type, which is a floating point number with a limited precision of 64 bits, about 16 digits. Floating point numbers round-off errors can occur during calculations:
    0.1 + 0.2;
    //=> 0.30000000000000004
    In most cases, round-off errors do not matter, they have no significant impact on the results. However, it looks ugly when displaying output to a user. A solution is to limit the precision just below the actual precision of 16 digits in the displayed output:
    (0.1 + 0.2).toPrecision(14);
    //=> 0.3

πŸ“š Documentation

Getting Started

Install

  • NodeJS >= v6.9.0
  • NPM >= v3.10.8
npm install @hugoalh/temperature

Use In CommonJS

const Temperature = require("@hugoalh/temperature");

Use In ModuleJS

import Temperature from "@hugoalh/temperature";

API

Class

new Temperature(value: number, unit?: string = "K"): Temperature
Temperature.difference(a: Temperature, b: Temperature): TemperatureDifference

Example

new Temperature(25, "C").K
//=> 298.15

new Temperature(298.15).C
//=> 25