DEV Community

loading...

Discussion on: ✔||🤢 Commit or Vomit | function currying 🍛

Collapse
sargalias profile image
Spyros Argalias • Edited

This is an enjoyable series, keep it up :).

Vomit.

At first glance, it feels unusual for the multiply function to accept 3 arguments. I would expect either 2 arguments or a variable number of arguments (...args). However, that's up for discussion depending on the specific case.

Then, if it needs currying, it could be done with a curry utility instead. We can make our own or import the one from Ramda or something.

import {curry} from 'ramda';
const multiply = curry((a, b) => a * b);
Enter fullscreen mode Exit fullscreen mode

EDIT: Finished comment after submitting early by accident...

Collapse
jmdejager profile image
🐤🥇 Jasper de Jager Author

Now I'm definitely going tot try currying, turns out I didn't know much about it 🙂
Really love this community thnx all! 😎