Last active
February 21, 2018 11:20
-
-
Save ealush/42bd30af61846acf7cffc07c91a8f455 to your computer and use it in GitHub Desktop.
enforce: custom rules
This file contains hidden or 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
| const enforce = new Enforce({ | |
| hasDog: (value) => /dog/.test(value) | |
| }); | |
| enforce('dog').hasDog(); | |
| // Proxy {isArray: ƒ, largerThan: ƒ, smallerThan: ƒ, isEmpty: ƒ, hasDog: ƒ} | |
| enforce('cat').hasDog(); | |
| // Uncaught Error: hasDog: YOU SHALL NOT PASS! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment