Created
February 21, 2018 10:39
-
-
Save ealush/e55e5b6da8e5a74455db197ab8714955 to your computer and use it in GitHub Desktop.
enforce: test proxy approach
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(); | |
| enforce(55); | |
| // Proxy {isArray: ƒ, largerThan: ƒ, smallerThan: ƒ, isEmpty: ƒ} | |
| enforce(55).largerThan(20); | |
| // Proxy {isArray: ƒ, largerThan: ƒ, smallerThan: ƒ, isEmpty: ƒ} | |
| enforce(55).largerThan(200); | |
| // Uncaught Error: largerThan: YOU SHALL NOT PASS! | |
| enforce(55).largerThan(20).smallerThan(200) | |
| // enforce(55).largerThan(20).smallerThan(200) | |
| enforce(55).largerThan(20).smallerThan(200).isArray(); | |
| // Uncaught Error: isArray: YOU SHALL NOT PASS! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment