Skip to content

Commit

Permalink
refactor(yaml): remove variable underscore (#5741)
Browse files Browse the repository at this point in the history
  • Loading branch information
timreichen committed Aug 20, 2024
1 parent 6c70fa9 commit 99200dc
Showing 1 changed file with 16 additions and 16 deletions.
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 @@ export class DumperState {
}

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 @@ export class DumperState {
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 @@ export class DumperState {
});
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 += "-";
} 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 @@ export class DumperState {
pairBuffer += valueString;

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

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

stringifyBlockMapping(
Expand All @@ -680,7 +680,7 @@ export class DumperState {
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 @@ export class DumperState {
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

0 comments on commit 99200dc

Please sign in to comment.