JS: simplify static boolean expressions
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go, javascript
- Domain
- tooling
Research direction
Start by reading the JavaScript minifier entry point and its tests for static expressions; the issue does not name specific files. Check how boolean literals are currently emitted, then add coverage for both if (true) and if (false) cases. Done means static boolean conditions are evaluated away while nonstatic conditions remain unaffected.
Written by the indexing model from the issue text.
Description
Example of code which is not optimized:
if (true) {
console.log("true")
}
if (false) {
console.log("false")
}
It is minified into !0&&console.log("true"),!1&&console.log("false") while it would be better to pre-evaluate the expression and just minify it into console.log("true") (of course only static boolean values).
Thanks!
- Dominant language
- Go
- Stars
- 4.1k
- Forks
- 244
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 10
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tdewolff/minify
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
tdewolff/minify#1017 · 1 comment ·
Maintainers usually reply within 1 day
-
HTML: Lacks go action supportPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
tdewolff/minify#976 · 2 comments ·
Maintainers usually reply within 1 day
-
CSS: support scope at-rulesPossibly taken @AdamMagued claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
tdewolff/minify#917 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
tdewolff/minify#911 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Project submission:Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#845 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
JakeChampion/lang#13132 ·
Maintainers usually reply within 1 day
-
[BUG] deploy.restart_policy without condition drops the restart policyPossibly taken @akshat-lakhera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
docker/compose#14383 · 1 comment ·
Maintainers usually reply within 1 day