Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(yaml): remove variable underscore #5741

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions yaml/_dumper_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
}

stringifyFlowSequence(object: unknown[], level: number): string {
let _result = "";
let result = "";
for (let index = 0; index < object.length; index += 1) {
// Write only valid elements.
const string = this.stringifyNode(level, object[index], {
Expand All @@ -587,19 +587,19 @@
isKey: false,
});
if (string === null) continue;
if (index !== 0) _result += `,${!this.condenseFlow ? " " : ""}`;
_result += string;
if (index !== 0) result += `,${!this.condenseFlow ? " " : ""}`;
result += string;
}

return `[${_result}]`;
return `[${result}]`;
}

stringifyBlockSequence(
object: unknown[],
level: number,
compact: boolean,
): string {
let _result = "";
let result = "";

for (let index = 0; index < object.length; index += 1) {
// Write only valid elements.
Expand All @@ -610,24 +610,24 @@
});
if (string !== null) {
if (!compact || index !== 0) {
_result += generateNextLine(this.indent, level);
result += generateNextLine(this.indent, level);
}

if (string && LINE_FEED === string.charCodeAt(0)) {
_result += "-";
result += "-";

Check warning on line 617 in yaml/_dumper_state.ts

View check run for this annotation

Codecov / codecov/patch

yaml/_dumper_state.ts#L617

Added line #L617 was not covered by tests
} else {
_result += "- ";
result += "- ";
}

_result += string;
result += string;
}
}

return _result || "[]"; // Empty sequence if no valid values.
return result || "[]"; // Empty sequence if no valid values.
}

stringifyFlowMapping(object: Record<string, unknown>, level: number): string {
let _result = "";
let result = "";
const objectKeyList = Object.keys(object);

for (const [index, objectKey] of objectKeyList.entries()) {
Expand Down Expand Up @@ -667,10 +667,10 @@
pairBuffer += valueString;

// Both key and value are valid.
_result += pairBuffer;
result += pairBuffer;
}

return `{${_result}}`;
return `{${result}}`;
}

stringifyBlockMapping(
Expand All @@ -680,7 +680,7 @@
compact: boolean,
): string {
const objectKeyList = Object.keys(object);
let _result = "";
let result = "";

// Allow sorting keys so that the output file is deterministic
if (this.sortKeys === true) {
Expand Down Expand Up @@ -749,10 +749,10 @@
pairBuffer += valueString;

// Both key and value are valid.
_result += pairBuffer;
result += pairBuffer;
}

return _result || "{}"; // Empty mapping if no valid pairs.
return result || "{}"; // Empty mapping if no valid pairs.
}

detectType(
Expand Down