Hacker News new | ask | show | jobs
by bdc 4841 days ago
On the subject of minification, I see a lot of lines that look like this[1]:

  fireToken : 1 === f.tradeTokens.data.fireToken ? !0 : !1,
Why might that be a desired output from a minifier? Why not simply

  fireToken : 1 === f.tradeTokens.data.fireToken,
[1] https://gist.github.com/anonymous/5133829#file-simcityui-js-...
2 comments

The original code could have been written as "condition ? true : false" and it's just not a pattern the minifier picks up on.
Probably a terrible mistake from the developer, not the minifier.

    fireToken: f.tradeTokens.data.fireToken === 1 ? true : false
In my company I see JS code like the following:

    if (!!someFlag) { /* ... */ }