code: function _batchDetails(context, result, maxResults, cb) {
    if (result.results.length === 0) return cb(null, {details: [], errors: []});
    var details = [];
    var errors = [];
    var j = (maxResults > result.results.length) ? result.results.length : maxResults;
    for (var i = 0; i < j; i++) {
      try {
        var placeid = result.results[i].place_id;
        context.details({placeid: placeid}, function(err, result){
          if (err) {
            errors.push({message: "Error requesting details for placeid " + placeid, error: err});
          } else {
            details.push(result);
          }
          if (details.length + errors.length == j) return cb(null, {details: details, errors: errors});
        });
      } catch (exp) {
        errors.push({message: "No place_id found", error: exp});
        if (details.length + errors.length == j) return cb(null, {details: details, errors: errors});
      }
    }
  }
docs: /* Helper Functions