Use Prettier for JS files (#3913)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
function formatLines (...lines) {
|
||||
function formatLines(...lines) {
|
||||
return [...indentEach(0, lines)].join('\n') + '\n';
|
||||
}
|
||||
|
||||
function *indentEach (indent, lines) {
|
||||
function* indentEach(indent, lines) {
|
||||
for (const line of lines) {
|
||||
if (Array.isArray(line)) {
|
||||
yield * indentEach(indent + 1, line);
|
||||
yield* indentEach(indent + 1, line);
|
||||
} else {
|
||||
const padding = ' '.repeat(indent);
|
||||
yield * line.split('\n').map(subline => subline === '' ? '' : padding + subline);
|
||||
yield* line.split('\n').map(subline => (subline === '' ? '' : padding + subline));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user