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