demirhanaydin / node-mi-flora

Node package for Xiaomi Mi Flora Plant Sensor
53 stars 21 forks source link

Replace let statement for var #12

Closed rrooggiieerr closed 6 years ago

rrooggiieerr commented 6 years ago

Hi!

So I'm writing a plugin for Mi Flora for Pimatic, I would like to use this node-mi-flora module however Pimatic depends on an older version of Node.js. Don's ask me why.

Anyhow, I get the error message "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"

This is because the node-mi-flora module declares variables using the let statement instead of the var one.

To my understanding the behaviour of a variable defined with the let statement is the same as with the var statement if the variable is within the scope of a function, which is the case in the node-mi-flora module.

Is it possible to replace the let statement for the var one? To my understanding this would not change the functionality of the code whatsoever, however makes the code more backwards compatible.

rrooggiieerr commented 6 years ago

Actually, never mind, this is not going to work...