lib/services.js
function insertRemoteProtocols(cache, ptcls, svc, isClient) {
  Object.keys(ptcls).forEach(function (hash) {
    var ptcl = ptcls[hash];
    var clientSvc, serverSvc;
    if (isClient) {
      clientSvc = svc;
      serverSvc = Service.forProtocol(ptcl);
    } else {
      clientSvc = Service.forProtocol(ptcl);
      serverSvc = svc;
    }
    cache[hash] = new Adapter(clientSvc, serverSvc, hash, true);
  });
}
function insertRemoteProtocols(cache, ptcls, svc, isClient) {
  Object.keys(ptcls).forEach(function (hash) {
    var ptcl = ptcls[hash];
    var clientSvc, serverSvc;
    if (isClient) {
      clientSvc = svc;
      serverSvc = Service.forProtocol(ptcl);
    } else {
      clientSvc = Service.forProtocol(ptcl);
      serverSvc = svc;
    }
    cache[hash] = new Adapter(clientSvc, serverSvc, hash, true);
  });
}
function insertRemoteProtocols ( cache , ptcls , svc , isClient ) { Object . keys ( ptcls ) . forEach ( function ( hash ) { var ptcl = ptcls [ hash ] ; var clientSvc , serverSvc ; if ( isClient ) { clientSvc = svc ; serverSvc = Service . forProtocol ( ptcl ) ; } else { clientSvc = Service . forProtocol ( ptcl ) ; serverSvc = svc ; } cache [ hash ] = new Adapter ( clientSvc , serverSvc , hash , true ) ; } ) ; }
Populate a cache from a list of protocols.

@param cache {Object} Cache of adapters.
@param svc {Service} The local service (either client or server).
@param ptcls {Array} Array of protocols to insert.
@param isClient {Boolean} Whether the local service is a client's or
server's.
Populate a cache from a list of protocols .