rest - decorate functions so you can bind "rest" arguments with f.rest().
// Decorate a function with a method that allows you to bind "rest" args | |
// (everything except the first argument). | |
// Usage: | |
// | |
// const f = rest((a, b, c) => a + b + c) | |
// const fbc = f.rest("b", "c") | |
// fbc("a") | |
// // "abc" | |
const rest = f => { | |
f.rest = (...rest) => v => f(v, ...rest) | |
return f | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment