Write partial(fn, ...preset) that fixes the first arguments of fn, and use it to create a logger with a fixed level and an email sender with a fixed sender address.
[WARN] auth: token expires soon
[WARN] db: slow query
support@lf.in → asha@lf.in: Your certificate is ready
partial returns an arrow that combines the preset arguments with the ones supplied later. Unlike currying, any number of arguments can be fixed at once.
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!
We use Google Analytics cookies to see how LearnFrenzy is used and make it better, and Google AdSense to keep it free.
No analytics or ad cookies are set until you accept. Privacy Policy
·
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!