expose function.
This commit is contained in:
parent
5eb3946e38
commit
020d09a6fe
12
lib/bcoin.js
12
lib/bcoin.js
@ -7,7 +7,7 @@
|
||||
* https://github.com/indutny/bcoin
|
||||
*/
|
||||
|
||||
var Environment = require('./bcoin/env');
|
||||
var env = require('./bcoin/env');
|
||||
var utils = require('./bcoin/utils');
|
||||
var global = utils.global;
|
||||
|
||||
@ -22,5 +22,11 @@ if (utils.isBrowser)
|
||||
* @returns {Environment}
|
||||
*/
|
||||
|
||||
utils.merge(exports, Environment.prototype);
|
||||
Environment.call(exports);
|
||||
function BCoin(options) {
|
||||
env.setDefaults(options);
|
||||
return BCoin;
|
||||
}
|
||||
|
||||
utils.merge(BCoin, env);
|
||||
|
||||
module.exports = BCoin;
|
||||
|
||||
@ -198,6 +198,9 @@ function Environment(options) {
|
||||
}
|
||||
|
||||
Environment.prototype.setDefaults = function setDefaults(options) {
|
||||
if (typeof options === 'string')
|
||||
options = { network: options };
|
||||
|
||||
options = utils.merge({}, options);
|
||||
|
||||
options.prefix = options.prefix
|
||||
@ -327,4 +330,5 @@ Environment.prototype.now = function now() {
|
||||
return this.time.now();
|
||||
};
|
||||
|
||||
module.exports = Environment;
|
||||
utils.merge(exports, Environment.prototype);
|
||||
Environment.call(exports);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user