Wrap code within a closure function

This commit is contained in:
Samer Albahra
2015-07-01 18:45:27 -05:00
parent 8c7d5b5bc7
commit 664cc3666a

View File

@@ -1,3 +1,5 @@
( function() {
// Define regex filters to match against location // Define regex filters to match against location
var http = require( "http" ), var http = require( "http" ),
filters = { filters = {
@@ -186,6 +188,10 @@ function checkWeatherRestriction( adjustmentValue, weather ) {
// adjustment method which is encoded to also carry the watering // adjustment method which is encoded to also carry the watering
// restriction and therefore must be decoded // restriction and therefore must be decoded
exports.getWeather = function( req, res ) { exports.getWeather = function( req, res ) {
// The adjustment method is encoded by the OpenSprinkler firmware and must be
// parsed. This allows the adjustment method and the restriction type to both
// be saved in the same byte.
var adjustmentMethod = req.params[0] & ~( 1 << 7 ), var adjustmentMethod = req.params[0] & ~( 1 << 7 ),
adjustmentOptions = req.query.wto, adjustmentOptions = req.query.wto,
location = req.query.loc, location = req.query.loc,
@@ -268,4 +274,5 @@ exports.getWeather = function( req, res ) {
} ); } );
} }
}; };
} )();