Esc

compact_js

procedureextensionexperimentalsince 0.36.1Source
  • macOS: compact_js works on macOS
  • Linux: compact_js works on Linux
  • Windows: compact_js works on Windows
  • Wasm: compact_js is not available on Wasm

Drops indentation, blank lines and whole-line // comments, preserving other JS bytes. Multiline strings, template literals and block comments are kept verbatim internally.

Signature

compact_js :: (text: string) -> string
Example
assert(compact_js("  // note\n  let url = 'https://x';\n") == "let url = 'https://x';\n");

See also