iobroker-adapter-helpers

0.0.8 • Public • Published

iobroker-adapter-helpers

Some helper files

Usage of units and exponents:

Every unit has a base, this base has the exponent 0. Example meter: {"unit": "m", "exponent": 0}

With the exponent it is simple to convert the given unit in to a higher or lower unit.

This conversion is done with the function Math.pow(10, exponent).

const value = 1000          //unit mm
const baseExp = -3;         //exponent for mm
const expectedExp = -2;     //exponent for cm

console.log( ( value * Math.pow( 10, (baseExp - expectedExp) ) + ' cm' ); //output 100 cm

Readme

Keywords

none

Package Sidebar

Install

npm i iobroker-adapter-helpers

Weekly Downloads

52

Version

0.0.8

License

none

Unpacked Size

72.2 kB

Total Files

15

Last publish

Collaborators

  • patrickwaltherh
  • dutchmannl
  • apollon77
  • meistertr
  • prinzeisenherz1
  • bluefox
  • nisiode
  • alcalzone
  • zefau
  • garfonso
  • forelleblau
  • buzzy1337
  • raintonr
  • pdbjjens
  • unclesamswiss
  • _shojo_
  • swedish.chef
  • thiemoh
  • sven-s-ter
  • ciddi89
  • ruhr70
  • arteck
  • mcm1957
  • issi
  • foxriver76
  • pmant
  • dkleber89
  • simatec
  • matten-matten