Skip to content

Commit

Permalink
Open up regex (#31)
Browse files Browse the repository at this point in the history
* Open up regex. closes #24

* More semantic name for regex.
  • Loading branch information
daspecster authored Jul 17, 2016
1 parent 27ceb88 commit 23a3f64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jquery.ziptastic.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
var requests = {};
var zipValid = {
us: /[0-9]{5}(-[0-9]{4})?/
pattern: /^[a-z0-9]+$/i
};
var protocol = '';
if (location.protocol == 'file:') {
Expand Down Expand Up @@ -93,7 +93,7 @@

ele.on('keyup change', function() {
var zip = ele.val();
if(zipValid.us.test(zip)) {
if(zipValid.pattern.test(zip)) {
$.ziptastic(options.country, zip, options.key, function(country, state, state_short, city) {
// Trigger the updated information
ele.trigger('zipChange', [country, state, state_short, city, zip]);
Expand Down

0 comments on commit 23a3f64

Please sign in to comment.