lib/agent.js
function prepareResults(contentTypes) {
  var results = _.reduce(contentTypes, function (result, contentType, key) {

    // If content type is string, treat is as content type id
    if(_.isString(contentType)){
      var id = contentType;
      contentType = {
        id: id
      }
    }
    contentType.name = key;
    result.push(contentType);
    return result;
  }, []);
  return when.resolve(results);
}
function prepareResults(contentTypes) {
  var results = _.reduce(contentTypes, function (result, contentType, key) {

    // If content type is string, treat is as content type id
    if(_.isString(contentType)){
      var id = contentType;
      contentType = {
        id: id
      }
    }
    contentType.name = key;
    result.push(contentType);
    return result;
  }, []);
  return when.resolve(results);
}
function prepareResults ( contentTypes ) { var results = _ . reduce ( contentTypes , function ( result , contentType , key ) { // If content type is string, treat is as content type id if ( _ . isString ( contentType ) ) { var id = contentType ; contentType = { id : id } } contentType . name = key ; result . push ( contentType ) ; return result ; } , [ ] ) ; return when . resolve ( results ) ; }
Convert object with content types to array with content types

FROM: { 'team-members': { id: '', filters: {} } }
TO: [ { id: '', filters: {}, name: 'team-members' } ]

@param contentTypes
@returns {*}
Convert object with content types to array with content types