|
|
|
|
|
by valty
837 days ago
|
|
I feel like JS needs auto-currying. function greet(greeting, name) {
return `${greeting} ${name}`
}
const greetWithGreetingHello = greet('hello')
greetWithGreetingHello('sally')
And this should work with named arguments too. function greet({greeting, name}) {
...
}
const greetWithGreetingHello = greet({greeting: 'hello'})
greetWithGreetingHello({name: 'sally'})
With named params, curried functions can be read more naturally too.greetWithGreetingHelloAndWith({name: 'sally'}). "and with name sally" |
|