first commit
This commit is contained in:
commit
a5a0434432
1126 changed files with 439481 additions and 0 deletions
16
Software/NodeJS/libs/sensors/helpers.js
Normal file
16
Software/NodeJS/libs/sensors/helpers.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function round(number, precision) {
|
||||
if (isNaN(number)) return NOT_AVAILABLE
|
||||
if (precision == undefined || isNaN(precision))
|
||||
precision = 2
|
||||
var factor = Math.pow(10, precision)
|
||||
var tempNumber = number * factor
|
||||
var roundedTempNumber = Math.round(tempNumber)
|
||||
return roundedTempNumber / factor
|
||||
}
|
||||
|
||||
const NOT_AVAILABLE = 'N/A'
|
||||
|
||||
module.exports = {
|
||||
round,
|
||||
NOT_AVAILABLE
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue