| 589 | } |
| 590 | |
| 591 | function getChildNodes(node: TSESTree.Node): TSESTree.Node[] { |
| 592 | const children: TSESTree.Node[] = []; |
| 593 | for (const value of Object.values(node)) { |
| 594 | if (Array.isArray(value)) { |
| 595 | for (const item of value) { |
| 596 | if (isNode(item)) { |
| 597 | children.push(item); |
| 598 | } |
| 599 | } |
| 600 | } else if (isNode(value)) { |
| 601 | children.push(value); |
| 602 | } |
| 603 | } |
| 604 | return children; |
| 605 | } |
| 606 | |
| 607 | function isNode(value: unknown): value is TSESTree.Node { |
| 608 | return value !== null && typeof value === 'object' && 'type' in value; |