in src/utils/astUtilityFunctions.ts [109:130]
export function getListOfStateNamesFromStateNode(node: PropertyASTNode, ignoreColonOffset = false): string[] {
const nodeName = node.keyNode.value
if (nodeName === 'States') {
// The first object node will contain property nodes containing state names
const objNode = node.children.find(isObjectNode)
return (
objNode?.children
// Filter out property nodes that do not have colonOffset. They are invalid.
.filter(
(childNode) =>
isPropertyNode(childNode) &&
childNode.colonOffset &&
(ignoreColonOffset || (!ignoreColonOffset && childNode.colonOffset >= 0)),
)
.map((propNode) => (propNode as PropertyASTNode).keyNode.value) ?? []
)
} else {
throw new Error('Not a state name property node')
}
}