Skip to content

Commit 7919c8c

Browse files
committed
Added auto-instantiators to classes
1 parent ff3679a commit 7919c8c

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

bitcoinjs-min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/address.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var p2sh_types = {
1414
};
1515

1616
var Address = function (bytes, version) {
17+
if (!(this instanceof Address)) { return new Address(bytes, version); }
1718
if (arguments[0] instanceof Address) {
1819
this.hash = arguments[0].hash;
1920
this.version = arguments[0].version;

src/transaction.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var ECDSA = require('./ecdsa');
99
var Address = require('./address');
1010

1111
var Transaction = function (doc) {
12+
if (!(this instanceof Transaction)) { return new Transaction(doc); }
1213
this.version = 1;
1314
this.lock_time = 0;
1415
this.ins = [];

src/wallet.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var SecureRandom = require('./jsbn/rng');
1515
var rng = new SecureRandom();
1616

1717
var Wallet = function (seed) {
18+
if (!(this instanceof Wallet)) { return new Wallet(seed); }
1819

1920
// Stored in a closure to make accidental serialization less likely
2021
var keys = [];

0 commit comments

Comments
 (0)