.isValid() is more convenient than .validate()
This commit is contained in:
parent
fa85fa4715
commit
ac47796acd
|
@ -10,10 +10,9 @@ function Address(obj) {
|
|||
this.set(obj);
|
||||
};
|
||||
|
||||
Address.validate = function(addrstr) {
|
||||
Address.isValid = function(addrstr) {
|
||||
var address = new Address().fromString(addrstr);
|
||||
address.validate();
|
||||
return this;
|
||||
return address.isValid();
|
||||
};
|
||||
|
||||
Address.prototype.set = function(obj) {
|
||||
|
|
|
@ -12,10 +12,10 @@ describe('Address', function() {
|
|||
should.exist(address);
|
||||
});
|
||||
|
||||
describe('@validate', function() {
|
||||
describe('@isValid', function() {
|
||||
|
||||
it('should validate this valid address string', function() {
|
||||
should.exist(Address.validate(str))
|
||||
Address.isValid(str).should.equal(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue