2014-03-05 11:11:16 -08:00
|
|
|
'use strict';
|
|
|
|
var imports = require('soop').imports();
|
|
|
|
var parent = imports.parent || require('./util/VersionedData');
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2014-03-05 11:11:16 -08:00
|
|
|
function Address() {
|
|
|
|
Address.super(this, arguments);
|
|
|
|
}
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2014-03-05 11:11:16 -08:00
|
|
|
Address.parent = parent;
|
|
|
|
parent.applyEncodingsTo(Address);
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2014-03-11 07:27:29 -07:00
|
|
|
|
2014-03-05 11:11:16 -08:00
|
|
|
Address.prototype.validate = function() {
|
|
|
|
this.doAsBinary(function() {
|
|
|
|
Address.super(this, 'validate', arguments);
|
2014-03-11 07:27:29 -07:00
|
|
|
if(this.data.length !== 21) throw new Error('invalid data length');
|
2014-03-05 11:11:16 -08:00
|
|
|
});
|
2014-03-11 07:27:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
Address.prototype.isValid = function() {
|
|
|
|
var answer = Address.super(this, 'isValid', arguments);
|
2014-03-11 06:21:26 -07:00
|
|
|
return answer;
|
2014-03-05 11:11:16 -08:00
|
|
|
};
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2014-03-05 11:11:16 -08:00
|
|
|
module.exports = require('soop')(Address);
|