News for hackers. Stuff that matters.
Re:Using Prettier to format your JavaScript code by z3t4 on Friday March 09, 2018 @03:38AM (#16550513)
There's nothing wrong with if statements. If you can't even understand the code yourself it's a sign that it needs to be rewritten.

  function x(result, Skip, obj, traverseObject, treverseArray) {
    if(! result instanceof Skip) return result;
    if(typeof obj === "object") return traverseObject(Object.keys(obj));
    if(Array.isArray(obj)) return traverseArray(obj);
    
    return new Skip("Not found.");
  }
Re:Using Prettier to format your JavaScript code by benoits on Friday March 09, 2018 @04:07AM (#16550581)
Agreed. I don't see what is so evil about early returns, they seem very clear to follow to me. Especially with proper IDE syntax highlighting.