Created
November 9, 2016 15:07
-
-
Save davidsharp/20bb5b31272138a3d52e511bc1affc48 to your computer and use it in GitHub Desktop.
A dumb ES6+ function for running multiple functions without parameters, with return values in a neat array
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 run = (...args) => (args.map(f=>f())) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's extra dumb about this is that it doesn't work with arrays, which is something you might even find useful to match functions with their output.
If you really fancy doing that though
run(...functionArray)will do the job.(I guess I could reduce the array if I get one, but where's the fun in that?)