logoalt Hacker News

OkayPhysicistyesterday at 9:30 PM1 replyview on HN

> 95% of this is covered by a warning that says "I won't merge any PR that a) does not pass linting (configured to my liking) and b) introduces extra deps"

Maybe I'm not up to date with the bleeding edge of linters, but I've never seen one that adequately flags

    let out = []
    for(let x of arr){
      if(x > 3){
        out.append(x + 5)
      }
    }
Into

   let out = arr
             .filter(x => x > 3)
             .map(x => x + 3)
There's all sorts of architectural decisions at even higher levels than that.

Replies

well_ackshuallyyesterday at 9:37 PM

Indeed, yours has both more allocations and a bug (+3 instead of +5)

show 1 reply