1234567891011121314151617181920 |
- "use strict";
- exports.__esModule = true;
- // eemeli/yaml uses fake `plain`s to store comments https://github.com/eemeli/yaml/commit/c04ab2c2
- function removeFakeNodes(node) {
- if ("children" in node) {
- if (node.children.length === 1) {
- var child = node.children[0];
- if (child.type === "plain" &&
- child.tag === null &&
- child.anchor === null &&
- child.value === "") {
- node.children.splice(0, 1);
- return node;
- }
- }
- node.children.forEach(removeFakeNodes);
- }
- return node;
- }
- exports.removeFakeNodes = removeFakeNodes;
|