downloads
Across all versions.
Download trend unavailable.
compatibility
Runtime metadata.
Across all versions.
Download trend unavailable.
Runtime metadata.
Pretty Fast is a source-map-generating JavaScript pretty printer, that is pretty fast.
npm install pretty-fastvar prettyFast = require("pretty-fast");
var uglyJS = "function ugly(){code()}";
var pretty = prettyFast(uglyJS, {
url: "test.js",
indent: " "
});
console.log(pretty.code);
// function ugly() {
// code()
// }
console.log(pretty.map);
// [object SourceMapGenerator](See the mozilla/source-map library for information on SourceMapGenerator instances, and source maps in general.)
url - The URL of the JavaScript source being prettified. Used in the
generated source map. If you are prettifying JS that isn't from a file or
doesn't have a URL, you can use a dummy value, such as "(anonymous)".
indent - The string that you want your code indented by. Most people want
one of " ", " ", or "\t".
ecmaVersion - Indicates the ECMAScript version to parse.
See acorn.parse documentation for more details. Defaults to "latest".
To be pretty fast, while still generating source maps.
To avoid fully parsing the source text; we should be able to get away with only a tokenizer and some heuristics.
Preserve comments.
Pretty Fast should be able to run inside Web Workers.
Extreme configurability of types of indentation, where curly braces go, etc.
To be the very fastest pretty printer in the universe. This goal is unattainable given that generating source maps is a requirement. We just need to be Pretty Fast.
To perfectly pretty print exactly as you would have written the code. This falls out from both not wanting to support extreme configurability, and avoiding full on parsing. We just aim to pretty print Pretty Well.
mythmon
mythmon@gmail.com
project-nimbus-publishing
project-nimbus-publishing@mozilla.com
gijs
gijskruitbosch@gmail.com
brizental
brizental@mozilla.com
aplacitelli
aplacitelli@mozilla.com
mozrhelmer
rhelmer@mozilla.com
knowtheory
ted@knowtheory.net
nbaumgardner
niklasbaumgardner@gmail.com
tigleym
tigleym@gmail.com
eemeli
eemeli@gmail.com
hmanilla
hmanilla+npm@mozilla.com
jdescottes-mozilla-npm
jdescottes+npm@mozilla.com
ahanot
ahanot+npm@mozilla.com
bgrant_mozilla
bgrant+npm@mozilla.com
mlifshin
mlifshin+npm@mozilla.com
llisi-moz
llisi+npm@mozilla.com
jdarcangelo-mozilla
jdarcangelo+npm@mozilla.com
nchevobbe
nchevobbe+npm@mozilla.com
mozilla-devtools
nfitzgerald@mozilla.com
nickfitzgerald
fitzgen@gmail.com
loganfsmyth
loganfsmyth@gmail.com
jasonlaster11
jason.laster.11@gmail.com
tromey
tom@tromey.com
Estimated unpacked size across 6 packages.
846.9 kB
Includes dependencies.
3 direct · 2 outdated