Function prettyprint

Source
pub fn prettyprint(source: &str) -> (String, Vec<SourceMapping>)
Expand description

Prettyprint JS source code. Returns the prettyprinted code, plus a list of SourceMappings in source order (both in original and prettyprinted code … we don’t reorder code).

The SourceMapping ‘from’ coordinates are in the prettyprinted code, the ‘to’ coordinates are in the original (presumably minified/obfuscated code).

Example:

let (pretty, _) = prettify_js::prettyprint("function x(a){return a;}");
assert_eq!(pretty, "function x(a) {\n  return a;\n}\n");