`link` is a string and empty string in JS  == `false`, this should be enough `if (link) {`