Merge pull request #294 from gordonwritescode/bug/extend
replace extend with underscore
This commit is contained in:
commit
177c1748d1
|
@ -1,5 +1,5 @@
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
var extend = imports.extend || require('extend');
|
var _ = imports._ || require('underscore');
|
||||||
var log = imports.log || require('../util/log');
|
var log = imports.log || require('../util/log');
|
||||||
var bitcoreDefaults = imports.config || require('../config');
|
var bitcoreDefaults = imports.config || require('../config');
|
||||||
var Connection = imports.Connection || require ('./Connection');
|
var Connection = imports.Connection || require ('./Connection');
|
||||||
|
@ -12,7 +12,7 @@ GetAdjustedTime = imports.GetAdjustedTime || function () {
|
||||||
|
|
||||||
function PeerManager(config) {
|
function PeerManager(config) {
|
||||||
// extend defaults with config
|
// extend defaults with config
|
||||||
this.config = extend(true, config || {}, bitcoreDefaults);
|
this.config = _.extend(bitcoreDefaults, config || {});
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@
|
||||||
"brfs": "=1.0.0",
|
"brfs": "=1.0.0",
|
||||||
"chai": "=1.9.1",
|
"chai": "=1.9.1",
|
||||||
"uglifyify": "=1.2.3",
|
"uglifyify": "=1.2.3",
|
||||||
"extend": "~1.2.1",
|
"async": "~0.2.10",
|
||||||
"async": "~0.2.10"
|
"underscore": "~1.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt-contrib-watch": "~0.5.3",
|
"grunt-contrib-watch": "~0.5.3",
|
||||||
|
|
|
@ -30,6 +30,16 @@ describe('PeerManager', function() {
|
||||||
pm.start();
|
pm.start();
|
||||||
pm.stop.bind(pm).should.not.throw();
|
pm.stop.bind(pm).should.not.throw();
|
||||||
});
|
});
|
||||||
|
it('should extend default config with passed config', function() {
|
||||||
|
var pm = new PeerManager({
|
||||||
|
proxy: {
|
||||||
|
host: 'localhost',
|
||||||
|
port: 9050
|
||||||
|
}
|
||||||
|
});
|
||||||
|
should.exist(pm.config.network);
|
||||||
|
should.exist(pm.config.proxy);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue