From ac47796acd722703e8ca335da1ea8295d5d26c29 Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Thu, 28 Aug 2014 17:30:32 -0700 Subject: [PATCH] .isValid() is more convenient than .validate() --- lib/address.js | 5 ++--- test/test.address.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/address.js b/lib/address.js index fb50e6f4c..b248aedfd 100644 --- a/lib/address.js +++ b/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) { diff --git a/test/test.address.js b/test/test.address.js index 9b9ff5061..0700e30eb 100644 --- a/test/test.address.js +++ b/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); }); });