* Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null.
(node, type)
| 6023 | */ |
| 6024 | |
| 6025 | function checkNodeType(node, type) { |
| 6026 | if (node && node.type === type) { |
| 6027 | // The definition of ParseNode<TYPE> doesn't communicate to flow that |
| 6028 | // `type: TYPE` (as that's not explicitly mentioned anywhere), though that |
| 6029 | // happens to be true for all our value types. |
| 6030 | // $FlowFixMe |
| 6031 | return node; |
| 6032 | } |
| 6033 | |
| 6034 | return null; |
| 6035 | } |
| 6036 | /** |
| 6037 | * Asserts that the node is of the given type and returns it with stricter |
| 6038 | * typing. Throws if the node's type does not match. |
no outgoing calls
no test coverage detected