controller.js
function(req) {
    var fields = {};

    // Fields
    if (_.isString(req.query.fields)) {
      _.forEach(req.query.fields.split(','), function(field) {
        fields[field] = 1;
      });
    }

    return fields;
  }
function(req) {
    var fields = {};

    // Fields
    if (_.isString(req.query.fields)) {
      _.forEach(req.query.fields.split(','), function(field) {
        fields[field] = 1;
      });
    }

    return fields;
  }
function ( req ) { var fields = { } ; // Fields if ( _ . isString ( req . query . fields ) ) { _ . forEach ( req . query . fields . split ( ',' ) , function ( field ) { fields [ field ] = 1 ; } ) ; } return fields ; }
Parses the request query string for `fields`

Converse it into a Mongo friendly `fields` Object

Example: `?fields=hello,world,foo.bar`

@param {Object} req
@return {Object}
Parses the request query string for fields