DEV Community

loading...

Discussion on: Making Sense of Syntax

Collapse
sirseanofloxley profile image
Sean Allin Newell

I have really started to prefer functions to provide clarity:

isTruthy(
  pluck(
    'item',
    merge(obj, obj2)
  )
);

What's powerful here is if this is common place, make a helper!

const eitherHasItem = (a, b) =>
  isTruthy(pluck('item', merge(a, b)));

eitherHasItem(obj, obj2); //true|false