Commit 4ff6379f39ae924c4b07f1019a4716bcceee6eda
Address: support instantiation from another Address
Alex Beregszaszi committed on 8/13/2016, 1:47:01 AMParent: feab13c39501456b20f90cec13af46229317a9e8
Files changed
address.js | changed |
address.js | ||
---|---|---|
@@ -1,8 +1,14 @@ | ||
1 | 1 | const ethUtils = require('ethereumjs-util') |
2 | 2 | |
3 | 3 | module.exports = class Address { |
4 | 4 | constructor (value) { |
5 | + // Special case: duplicate | |
6 | + if (value instanceof Address) { | |
7 | + this._value = new Buffer(value._value) | |
8 | + return | |
9 | + } | |
10 | + | |
5 | 11 | if (typeof value !== 'string') { |
6 | 12 | throw new Error('Invalid input to address') |
7 | 13 | } |
8 | 14 |
Built with git-ssb-web