expose function.

This commit is contained in:
Christopher Jeffrey 2016-05-13 09:34:09 -07:00
parent 5eb3946e38
commit 020d09a6fe
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 14 additions and 4 deletions

View File

@ -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;

View File

@ -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);