p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

Convert To Ternary #50

Closed hediet closed 1 year ago

hediet commented 1 year ago
let diff = 0;
if (last) {
    diff = last.outputRange.endLineNumberExclusive - last.inputRange.endLineNumberExclusive;
}

=>

const diff = last ? last.outputRange.endLineNumberExclusive - last.inputRange.endLineNumberExclusive : 0;
lgrammel commented 1 year ago

Implemented in v1.162.1 (except for const conversion).