Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pbakondy/reaumur

Conversion between units of temperature
https://github.com/pbakondy/reaumur

Last synced: 3 months ago
JSON representation

Conversion between units of temperature

Awesome Lists containing this project

README

        

# Réaumur.js

[![Build Status](https://travis-ci.org/pbakondy/reaumur.svg?branch=master)](https://travis-ci.org/pbakondy/reaumur)

Conversion between units of temperature:

- [Kelvin](http://en.wikipedia.org/wiki/Kelvin)
- [Celsius](http://en.wikipedia.org/wiki/Celsius)
- [Fahrenheit](http://en.wikipedia.org/wiki/Fahrenheit)
- [Felsius](https://xkcd.com/1923/)
- [Rankine](http://en.wikipedia.org/wiki/Rankine_scale)
- [Delisle](http://en.wikipedia.org/wiki/Delisle_scale)
- [Newton](http://en.wikipedia.org/wiki/Newton_scale)
- [Réaumur](http://en.wikipedia.org/wiki/R%C3%A9aumur_scale)
- [Rømer](http://en.wikipedia.org/wiki/R%C3%B8mer_scale)

## Installation

Grab the zip file or install with bower:

```
bower install reaumur
```

Or install it with npm:

```
npm install reaumur
```

## Usage

You can use this library as a **node.js module**, an **AMD module** or called from the global scope with **window.reaumur**.

The library starts with this initial value: 0 Kelvin.

The calculated temperature values are rounded to two digits.

The library methods are chainable.

### Methods

- reaumur.getScaleIDs() - returns the available scale identifiers in an Array
- [ 'K', 'C', 'F', 'Fe', 'R', 'D', 'N', 'Re', 'Ro' ]
- reaumur.get() - returns an object with the details of the current state
- { name: 'Kelvin', sign: 'K', value: 0 }
- reaumur.from( <scale>, <value> ) - sets and initial scale and value, chainable
- reaumur.to( <scale> ) - converts to a different scale, chainable
- reaumur.toAll() - returns all the converted values, chainable
- { 'K': <Reaumur object>, 'C': <Reaumur object>, 'F': <Reaumur object>, ... }
- reaumur.toString() - returns "value + sign" version of current state
- 0 K

### Examples

0 Kelvin to Celsius

```js
reaumur.from('K', 0).to('C').get()
// { name: "Celsius", sign: "°C", value: -273.15 }
```

0 Celsius to Kelvin

```js
reaumur.from('C', 0).to('K').get().value
// 273.15
```

0 Celsius to Fahrenheit

```js
reaumur.from('C', 0).to('F').get().value
// 32
```

35 Réaumur to Celsius ( [forrás](http://magyar-irodalom.elte.hu/ezredveg/0208-9/0208-93.html#rl) )

```js
reaumur.from('Re', 35).to('C').get().value
// 43.75
```

0 Celsius to all

```js
var all = reaumur.from('C', 0).toAll();
all.K.get().value // 273.15
all.F.get().value // 32
all.Re.get().value // 0
...
```

## Build

```
gulp build
```

## Test

Validation test (JS)

```
gulp lint
```

Unit test (with Karma, Jasmine and PhantomJS)

```
gulp test
```

## License

Réaumur.js is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.