lib/util/responseTranslator.js
function mapMongoAlertsToResponseObj(alerts){

  // Base response, regardless of whether we have alerts or not
  var res = {"list":[],"status":"ok"};

  // Filter and add alerts to response if we have them
  if (alerts){
    res.list = _.map(alerts, function(alert){
      var al = alert.toJSON();
      al.guid = alert._id;
      al.enabled = alert.alertEnabled;
      return al;
    });
  }
  // Return the response
  return res;
}
function mapMongoAlertsToResponseObj(alerts){

  // Base response, regardless of whether we have alerts or not
  var res = {"list":[],"status":"ok"};

  // Filter and add alerts to response if we have them
  if (alerts){
    res.list = _.map(alerts, function(alert){
      var al = alert.toJSON();
      al.guid = alert._id;
      al.enabled = alert.alertEnabled;
      return al;
    });
  }
  // Return the response
  return res;
}
function mapMongoAlertsToResponseObj ( alerts ) { // Base response, regardless of whether we have alerts or not var res = { "list" : [ ] , "status" : "ok" } ; // Filter and add alerts to response if we have them if ( alerts ) { res . list = _ . map ( alerts , function ( alert ) { var al = alert . toJSON ( ) ; al . guid = alert . _id ; al . enabled = alert . alertEnabled ; return al ; } ) ; } // Return the response return res ; }
Alerts from Mongo should not be coupled to response format
Map query result Alerts to single response object as it is defined
@param alerts
@returns {{}}
Alerts from Mongo should not be coupled to response format Map query result Alerts to single response object as it is defined