.isValid() is more convenient than .validate()

This commit is contained in:
Ryan X. Charles 2014-08-28 17:30:32 -07:00
parent fa85fa4715
commit ac47796acd
2 changed files with 4 additions and 5 deletions

View File

@ -10,10 +10,9 @@ function Address(obj) {
this.set(obj); this.set(obj);
}; };
Address.validate = function(addrstr) { Address.isValid = function(addrstr) {
var address = new Address().fromString(addrstr); var address = new Address().fromString(addrstr);
address.validate(); return address.isValid();
return this;
}; };
Address.prototype.set = function(obj) { Address.prototype.set = function(obj) {

View File

@ -12,10 +12,10 @@ describe('Address', function() {
should.exist(address); should.exist(address);
}); });
describe('@validate', function() { describe('@isValid', function() {
it('should validate this valid address string', function() { it('should validate this valid address string', function() {
should.exist(Address.validate(str)) Address.isValid(str).should.equal(true);
}); });
}); });