Search code examples
javascriptminify

How does it look in unminified version?


how I can translate marked part to non-minified version? It is minified Javascript:

function a(t, i){
   var u = null;
   t && (u = translate(t, i)); // <- This line
   //What value be 't'? And when 'u' will be translate(t, i)?
}

Solution

  • t && (u = translate(t, i));
    

    ...is taking advantage of the fact that boolean operators will short circuit once they can not possibly be true. So that code is the same as

    if (t) {
        u = translate(t, i)
    }
    

    EDIT:

    Ok thanks, and what about this please:

    return te && te.translate ? te.translate(e, t, n) : t || e
    

    That means:

    if (te && te.translate) {
      return te.translate(e, t, n);
    } else {
      return t || e;
    }