1.1.0-beta.5 • Published 8 years ago
scalafmt v1.1.0-beta.5
scalafmt
A JS API for scalafmt.
It exposes a single function:
format(code: string, configString?: string, ranges?: Range[]): string: formats the given code
where:
codeis the entire source code you want to formatconfigStringoptional is the Scalafmt configuration (as documented here). If not provided, the default one is used.rangesoptional is an array of ranges. If not provided, the entire document is formatted. Each range is an object with two properties:start: the start line of the rangeend: the end line of the range (not inclusive)
Example:
const { format } = require('scalafmt');
const input = `
object Main {
case class Foo(
a: String,
b: Boolean,
c: Int
)
val x = Foo("a", true
, 2)
}`;
const output = format(input);
console.log(output);
// Output:
// object Main {
// case class Foo(
// a: String,
// b: Boolean,
// c: Int
// )
// val x = Foo("a", true, 2)
// }1.1.0-beta.5
8 years ago
1.1.0-beta.4
8 years ago
1.1.0-beta.3
8 years ago
1.1.0-beta.2
8 years ago
1.1.0-beta.1
8 years ago