We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
summary I noticed that terser chooses not to inline values for objects where the whole object is retained. Is that intentional?
terser
For example given this the below input terser will aggressively inline the value. Input:
var CardSuits = { HEARTS: 'hearts', DIAMONDS: 'diamonds', SPADES: 'spades', CLUBS: 'clubs', }; console.log(CardSuits.HEARTS);
Output:
console.log('hearts');
Given input that requires the whole object be retained, terser will not inline. Input:
var CardSuits = { HEARTS: 'hearts', DIAMONDS: 'diamonds', SPADES: 'spades', CLUBS: 'clubs', }; console.log(CardSuits.HEARTS); function printSuits(s) { for (const k in CardSuits) { console.log(k); } } printSuits();
var o = { HEARTS: "hearts", DIAMONDS: "diamonds", SPADES: "spades", CLUBS: "clubs" }; console.log(o.HEARTS), function(s) { for (const s in o) console.log(s); }();
The text was updated successfully, but these errors were encountered:
The ideal end state is likely to inline when the length of the value is <= the property name.
<=
Sorry, something went wrong.
No branches or pull requests
summary
I noticed that
terser
chooses not to inline values for objects where the whole object is retained.Is that intentional?
For example given this the below input terser will aggressively inline the value.
Input:
Output:
Given input that requires the whole object be retained, terser will not inline.
Input:
Output:
The text was updated successfully, but these errors were encountered: