* Asserts that the node is of the given type and returns it with stricter * typing. Throws if the node's type does not match.
(node, family)
| 6005 | */ |
| 6006 | |
| 6007 | function assertAtomFamily(node, family) { |
| 6008 | const typedNode = checkAtomFamily(node, family); |
| 6009 | |
| 6010 | if (!typedNode) { |
| 6011 | throw new Error(`Expected node of type "atom" and family "${family}", but got ` + (node ? node.type === "atom" ? `atom of family ${node.family}` : `node of type ${node.type}` : String(node))); |
| 6012 | } |
| 6013 | |
| 6014 | return typedNode; |
| 6015 | } |
| 6016 | /** |
| 6017 | * Returns the node more strictly typed iff it is of the given type. Otherwise, |
| 6018 | * returns null. |
no test coverage detected