Created
July 5, 2019 20:56
-
-
Save ashtonmeuser/248cf73bcd76191616e6ad1acd1160fe to your computer and use it in GitHub Desktop.
Execute or abandon function based on result of assertion function taking same arguments
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 wrapper = (as, fn) => ((...args) => { | |
| try { | |
| as(...args); | |
| } catch (error) { | |
| return () => {}; | |
| } | |
| return fn(...args); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment