Skip to content

Commit 1af87b2

Browse files
authored
refactor(yaml): remove anchor undefined check (#6915)
1 parent 9145d20 commit 1af87b2

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

yaml/_loader_state.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ export class LoaderState {
365365
const anchor = this.anchor;
366366
const result: unknown[] = [];
367367

368-
if (this.anchor !== null && typeof this.anchor !== "undefined") {
369-
this.anchorMap.set(this.anchor, result);
370-
}
368+
if (this.anchor !== null) this.anchorMap.set(this.anchor, result);
371369

372370
let ch = this.peek();
373371

@@ -844,9 +842,7 @@ export class LoaderState {
844842
return false;
845843
}
846844

847-
if (this.anchor !== null && typeof this.anchor !== "undefined") {
848-
this.anchorMap.set(this.anchor, result);
849-
}
845+
if (this.anchor !== null) this.anchorMap.set(this.anchor, result);
850846

851847
ch = this.next();
852848

@@ -1122,9 +1118,7 @@ export class LoaderState {
11221118
let atExplicitKey = false;
11231119
let detected = false;
11241120

1125-
if (this.anchor !== null && typeof this.anchor !== "undefined") {
1126-
this.anchorMap.set(this.anchor, result);
1127-
}
1121+
if (this.anchor !== null) this.anchorMap.set(this.anchor, result);
11281122

11291123
let ch = this.peek();
11301124

@@ -1502,9 +1496,7 @@ export class LoaderState {
15021496
}
15031497

15041498
this.result = type.construct(this.result);
1505-
if (this.anchor !== null) {
1506-
this.anchorMap.set(this.anchor, this.result);
1507-
}
1499+
if (this.anchor !== null) this.anchorMap.set(this.anchor, this.result);
15081500
}
15091501
composeNode(
15101502
{ parentIndent, nodeContext, allowToSeek, allowCompact }: {

0 commit comments

Comments
 (0)