Merge pull request #967 from yemel/fix/I5-uri

Implement I5 on URI
This commit is contained in:
Braydon Fuller 2015-01-15 17:05:34 -05:00
commit e42e96cae0
2 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,10 @@ var JSUtil = require('./util/js');
* @constructor
*/
var URI = function(data, knownParams) {
if (!(this instanceof URI)) {
return new URI(data, knownParams);
}
this.extras = {};
this.knownParams = knownParams || [];
this.address = this.network = this.amount = this.message = null;

View File

@ -68,6 +68,11 @@ describe('URI', function() {
}).should.throw(TypeError);
});
it('do not need new keyword', function() {
var uri = URI('bitcoin:1DP69gMMvSuYhbnxsi4EJEFufUAbDrEQfj');
uri.should.be.instanceof(URI);
});
describe('instantiation from bitcoin uri', function() {
/* jshint maxstatements: 25 */
var uri;