const zip = {
  _regex: {
    default: /^([0-9]{5})(?:[-\s]*([0-9]{4}))?$/,
    ca: /^([A-Z][0-9][A-Z])\s*([0-9][A-Z][0-9])$/
  },
  default: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(zip._regex.default)) {
      context.fail('Value must be a valid US zip code')
    }
  },
  ca: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(zip._regex.ca)) {
      context.fail('Value must be a valid Canadian zip code')
    }
  }
}

module.exports = zip

@@ -144,36 +144,52 @@
 ontext =%3E %7B%0A    
-if (
+const stringified = 
 context.value ==
@@ -182,36 +182,35 @@
 ntext.value 
-=
+!
 = null 
-%7C%7C !
+&& 
 context.valu
@@ -215,43 +215,78 @@
 lue.
-length %7C%7C !context.value.toString()
+toString()%0A    if (!stringified %7C%7C !stringified.length %7C%7C !stringified
 .mat
@@ -401,20 +401,36 @@
 %3E %7B%0A    
-if (
+const stringified = 
 context.
@@ -439,20 +439,19 @@
 lue 
-=
+!
 = null 
-%7C%7C !
+&& 
 cont
@@ -464,43 +464,78 @@
 lue.
-length %7C%7C !context.value.toString()
+toString()%0A    if (!stringified %7C%7C !stringified.length %7C%7C !stringified
 .mat

allow numeric zip codes