Created
March 17, 2019 00:02
-
-
Save KevSlashNull/8e6c038910c89d14d0e88080ec7ae175 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* "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