(nodes: SplootNode[], nodeCategory: NodeCategory, trim = true)
| 13 | nodeCategory: NodeCategory |
| 14 | |
| 15 | constructor(nodes: SplootNode[], nodeCategory: NodeCategory, trim = true) { |
| 16 | this.nodeCategory = nodeCategory |
| 17 | this.nodes = nodes |
| 18 | if (trim) { |
| 19 | this.trim() |
| 20 | } |
| 21 | this.nodes.forEach((node) => { |
| 22 | if (!isNodeInCategory(node.type, this.nodeCategory)) { |
| 23 | throw new InvariantViolationError( |
| 24 | InvariantViolationType.FragmentNodeCategory, |
| 25 | `${node.type} is not valid for fragment category ${this.nodeCategory}.` |
| 26 | ) |
| 27 | } |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | trim() { |
| 32 | // Trim invisible nodes |
nothing calls this directly
no test coverage detected