code: function(typePrefix, name) {
              var vcapServices = (typeof process.env.VCAP_SERVICES === 'string' ?
                                  JSON.parse(process.env.VCAP_SERVICES) : {});
              var matchType = new RegExp('^' + typePrefix);
              for (var type in vcapServices) {
                  if (matchType.test(type)) {
                      var svcDef = vcapServices[type];
                      if (Array.isArray(svcDef)) {
                          if (name) {
                              for (var svc in svcDef) {
                                  var val = svcDef[svc];
                                  if ((typeof val === 'object') &&
                                      (val.name === name)) {
                                      return val.credentials;
                                  }
                              }
                          } else {
                              var service = svcDef[0];
                              if (typeof service === 'object') {
                                  return service.credentials;
                              }
                          }
                      }
                  }
              }
              return undefined;
          }
docs: /*
  format example for vcapServices:
  
  {'redis-<version>' : [ {'name' : <string>,
  'credentials' : { 'hostname': <string>,
  'port': <number> ,
  'password' : <string>,...
  },...
  }
  ]}