lib/util/responseTranslator.js
function mapMongoNotificationsToResponseObj(notifications){

  // 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 (notifications){
    res.list = _.map(notifications, function(notification){
      return notification.toJSON();
    });
  }
  // Return the response
  return res;
}
function mapMongoNotificationsToResponseObj(notifications){

  // 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 (notifications){
    res.list = _.map(notifications, function(notification){
      return notification.toJSON();
    });
  }
  // Return the response
  return res;
}
function mapMongoNotificationsToResponseObj ( notifications ) { // 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 ( notifications ) { res . list = _ . map ( notifications , function ( notification ) { return notification . toJSON ( ) ; } ) ; } // Return the response return res ; }
Notifications from Mongo should not be coupled to response format
Map query result Notifications to single response object as it is defined
@param alerts
@returns {{}}
Notifications from Mongo should not be coupled to response format Map query result Notifications to single response object as it is defined