-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
In the README.md We should better describe the usage. So everyone better understands how to implement this. Something Like:
"First you need to import Unibeautify and load a beautifier to it, so Unibeautify can use beautifier to beautify your text/file that you give it later. Next you need to specfiy some options, have a look here [LINK] to see all available options for the beautifier and language. After that you pass the test/file to the beautifier and wait for the result."
import { Unibeautify } from "unibeautify";
import beautifier from "@unibeautify/beautifier-eslint";
const unibeautify = Unibeautify();
unibeautify.loadBeautifier(beautifier);
const text = `if (foo) {bar();} else {baz();}`;
unibeautify
.beautify({
languageName: "JavaScript",
options: {
JavaScript: {
brace_style: "collapse",
indent_style: "tab"
}
},
text
})
.then(results => {
console.log(results);
});Reactions are currently unavailable