source: node_modules/@swagger-api/apidom-ast/es/yaml/anchors-aliases/ReferenceManager.mjs@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 732 bytes
Line 
1import YamlScalar from "../nodes/YamlScalar.mjs";
2import YamlReferenceError from "../errors/YamlReferenceError.mjs";
3import { isAnchor } from "../nodes/predicates.mjs";
4import { YamlStyle, YamlStyleGroup } from "../nodes/YamlStyle.mjs";
5/* eslint-disable class-methods-use-this */
6class ReferenceManager {
7 addAnchor(node) {
8 if (!isAnchor(node.anchor)) {
9 throw new YamlReferenceError('Expected YAML anchor to be attached the the YAML AST node.', {
10 node
11 });
12 }
13 }
14 resolveAlias(alias) {
15 return new YamlScalar({
16 content: alias.content,
17 style: YamlStyle.Plain,
18 styleGroup: YamlStyleGroup.Flow
19 });
20 }
21}
22/* eslint-enable class-methods-use-this */
23
24export default ReferenceManager;
Note: See TracBrowser for help on using the repository browser.