DEV Community

Mark Lopez
Mark Lopez

Posted on

I hate Ramda.

Why would anyone code like this?

R.compose(
      R.ifElse(R.includes(R.isNil), R.always(null), R.identity),
      R.map(R.path(['order'])),
    )(ordersCreateData)
Enter fullscreen mode Exit fullscreen mode

It's also slower than normal JS, and is so hard to understand.

Here's the JS equivalent

const orders = ordersCreateData.map(item => item.order);
if (orders.includes(null) || orders.includes(undefined)) {
    orders = null;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
mattferrin profile image
Insight Lighthouse

I can read both equally well because I learned the basics of both. But I agree. Using const instead of let and avoiding assigning to the same variable twice is an important lesson in my opinion though. Disallowing mutation allows you to confidently know the end result of a function better. It also allows for greater machine optimization for concurrent or parallel execution in theory.