壓縮 JavaScript

去掉源代碼中多余的排版空白,輸出仍是文本而非壓縮檔案。

輸入: 文本結果: 文本

文本輸入

範例

Remove an unreachable branch from a feature check

輸入

function enabled() { if (false) { return "debug"; } return "ready"; }

Expected answer

function enabled(){return"ready"}
Fold a byte-count constant without changing its value

輸入

const kibibytes = 1024 * 1024; function bytes() { return kibibytes; }

Expected answer

const kibibytes=1048576;function bytes(){return 1048576}
Shorten local names in a rectangle-area helper

輸入

function area(width, height) { const result = width * height; return result; }

Expected answer

function area(n,r){return n*r}
Keep UTF-8 text intact while dropping whitespace

輸入

function greeting() { return "Bonjour, café ☕"; }

Expected answer

function greeting(){return"Bonjour, café ☕"}
Preserve the order of state changes in a counter

輸入

function count() { let n = 0; for (let i = 0; i < 4; i++) { n += i; } return n; }

Expected answer

function count(){let t=0;for(let n=0;n<4;n++)t+=n;return t}

相关工具

程式碼整理

操作参考

查看原始技术文檔 (English)