Implement I5 on URI
@ -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;
@ -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;