Browse Source

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

patch-2
Ryan X. Charles 11 years ago
parent
commit
ac47796acd
  1. 5
      lib/address.js
  2. 4
      test/test.address.js

5
lib/address.js

@ -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) {

4
test/test.address.js

@ -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…
Cancel
Save