Skip to content

Instantly share code, notes, and snippets.

@KevSlashNull
Created March 17, 2019 00:02
Show Gist options
  • Save KevSlashNull/8e6c038910c89d14d0e88080ec7ae175 to your computer and use it in GitHub Desktop.
Save KevSlashNull/8e6c038910c89d14d0e88080ec7ae175 to your computer and use it in GitHub Desktop.
/**
* "Shortester" Polish postal code validator without regular expressions
* Only 86 characters (when not couting the module export)!
*
* @params {string} code to validate
* @author Marcin Gajda (and KevSlashNull)
*/
v=c=>!!(c[4]&&+('1.'+c.slice(0,2)+c.slice(-3))&&' -_'.includes(c.slice(2,-3)))
module.exports = v;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment