If Not Null…
by in CodeSOD on 2018-04-26Robert needed to fetch some details about pump configurations from the backend. The API was poorly documented, but there were other places in the code which did that, so a quick search found this block:
var getConfiguration = function(){
....
var result = null;
result = getPumpConfiguration (areaID,subStationID,mngmtUnitID,lastServiceDate,service,format,result);
result = getPumpConfiguration (areaID,subStationID,null,lastServiceDate,null,format,result);
result = getPumpConfiguration (areaID,subStationID,null,lastServiceDate,service,null,result);
result = getPumpConfiguration (areaID,subStationID,mngmtUnitID,lastServiceDate,null,null,result);
result = getPumpConfiguration (areaID,subStationID,null,lastServiceDate,null,null,result);
return result;
}