'use strict';


angular.module('streamium.peer', [])

.service('PeerJS', function(bitcore) {

  function getPeerJSConfig(config, index) {
    if (index >= config.peerServers.length) throw new Error('Invalid Server number');

    var ret = angular.copy(config.peerJS);
    bitcore.deps._.extend(ret, config.peerServers[index]);
    ret.index = index;
    return ret;
  }

  return {
    primary: getPeerJSConfig(config, 0),
    secondary: getPeerJSConfig(config, 1),
    get: function(index) {
      return getPeerJSConfig(config, index);
    }
  };

});

'use strict';


angular.module('streamium.peer', [])

.service('PeerJS', function() {

  function getPeerJSConfig(config, index) {
    if (index >= config.peerServers.length) throw new Error('Invalid Server number');

    var ret  = angular.copy(config.peerJS);
    ret.key  = config.peerServers[index].key;
    ret.host = config.peerServers[index].host;
    ret.port = config.peerServers[index].port;
    ret.index = index;
    return ret;
  }

  return {
    primary: getPeerJSConfig(config, 0),
    secondary: getPeerJSConfig(config, 1),
    get: function(index) {
      return getPeerJSConfig(config, index);
    }
  };

});

--- 
+++ 
@@ -3,13 +3,15 @@
 
 angular.module('streamium.peer', [])
 
-.service('PeerJS', function(bitcore) {
+.service('PeerJS', function() {
 
   function getPeerJSConfig(config, index) {
     if (index >= config.peerServers.length) throw new Error('Invalid Server number');
 
-    var ret = angular.copy(config.peerJS);
-    bitcore.deps._.extend(ret, config.peerServers[index]);
+    var ret  = angular.copy(config.peerJS);
+    ret.key  = config.peerServers[index].key;
+    ret.host = config.peerServers[index].host;
+    ret.port = config.peerServers[index].port;
     ret.index = index;
     return ret;
   }
Extend object; dont add undefined `keys`
