Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
];
}
break;
case Kind.SCALAR:
const scalarNode = node as YAMLScalar;
if (scalarNode.parent && scalarNode.parent.kind == Kind.SEQ) {
return [{ path: curPath, node: scalarNode }];
} else {
return [{ path: curPath, node: scalarNode.parent }];
}
case Kind.SEQ:
const seqNode = node as YAMLSequence;
const mergedSequence = ([] as { path: ReadonlyArray<(string | number)>, node: YAMLNode }[]).concat(...(seqNode.items.map(
(childNode, index) => extractAllPaths(childNode, [...curPath, index]))));
return [...mergedSequence];
case Kind.INCLUDE_REF:
case Kind.ANCHOR_REF:
const refNode = node as YAMLAnchorReference;
return extractAllPaths(refNode.value, [...curPath]);
}
return [{ path: curPath, node: node }];
}