mirror of
https://github.com/denoland/std.git
synced 2024-11-21 12:40:03 +00:00
parent
890958ca48
commit
df562b1d28
@ -760,19 +760,7 @@ export class DumperState {
|
||||
) {
|
||||
compact = false;
|
||||
}
|
||||
if (!Array.isArray(value)) {
|
||||
if (block && Object.keys(value).length !== 0) {
|
||||
value = this.stringifyBlockMapping(value, { tag, level, compact });
|
||||
if (duplicate) {
|
||||
value = `&ref_${duplicateIndex}${value}`;
|
||||
}
|
||||
} else {
|
||||
value = this.stringifyFlowMapping(value, { level });
|
||||
if (duplicate) {
|
||||
value = `&ref_${duplicateIndex} ${value}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(value)) {
|
||||
const arrayLevel = !this.arrayIndent && level > 0 ? level - 1 : level;
|
||||
if (block && value.length !== 0) {
|
||||
value = this.stringifyBlockSequence(value, {
|
||||
@ -788,6 +776,18 @@ export class DumperState {
|
||||
value = `&ref_${duplicateIndex} ${value}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (block && Object.keys(value).length !== 0) {
|
||||
value = this.stringifyBlockMapping(value, { tag, level, compact });
|
||||
if (duplicate) {
|
||||
value = `&ref_${duplicateIndex}${value}`;
|
||||
}
|
||||
} else {
|
||||
value = this.stringifyFlowMapping(value, { level });
|
||||
if (duplicate) {
|
||||
value = `&ref_${duplicateIndex} ${value}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
if (tag !== "?") {
|
||||
|
Loading…
Reference in New Issue
Block a user