1.1.0 • Published 6 years ago

reaumur v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Réaumur.js

Build Status

Conversion between units of temperature:

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
  • 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

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

0 Celsius to Kelvin

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

0 Celsius to Fahrenheit

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

35 Réaumur to Celsius ( forrás )

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

0 Celsius to all

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.