Browse Source

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

Implement I5 on URI
patch-2
Braydon Fuller 10 years ago
parent
commit
e42e96cae0
  1. 4
      lib/uri.js
  2. 5
      test/uri.js

4
lib/uri.js

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

5
test/uri.js

@ -68,6 +68,11 @@ describe('URI', function() {
}).should.throw(TypeError); }).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() { describe('instantiation from bitcoin uri', function() {
/* jshint maxstatements: 25 */ /* jshint maxstatements: 25 */
var uri; var uri;

Loading…
Cancel
Save