Skip to content

Commit

Permalink
Changes [build image]
Browse files Browse the repository at this point in the history
  • Loading branch information
Electroid committed Nov 14, 2024
1 parent 13bd47a commit 0c3c11d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,22 +1998,15 @@ export function toYaml(object, depth = 0) {
if (object.length === 0) {
return indent("[]");
}
return object.map(item => indent("- ") + toYaml(item, depth + 1).substring((depth + 1) * 2)).join("\n");
return object.map(item => indent("- ") + toYaml(item, depth + 1)).join("\n");
}

if (typeof object === "object") {
if (Object.keys(object).length === 0) {
return indent("{}");
}
return Object.entries(object)
.map(([key, value]) => {
const string = toYaml(value, depth + 1);
return (
indent(`${escapeYaml(key)}:`) +
(string.startsWith(" ".repeat((depth + 1) * 2)) ? "" : " ") +
string.substring(depth * 2)
);
})
.map(([key, value]) => indent(`${escapeYaml(key)}: ${toYaml(value, depth + 1)}`))
.join("\n");
}

Expand Down

0 comments on commit 0c3c11d

Please sign in to comment.