MCPcopy Index your code
hub / github.com/SplootCode/splootcode / constructor

Method constructor

packages/core/src/language/fragment.ts:15–29  ·  view source on GitHub ↗
(nodes: SplootNode[], nodeCategory: NodeCategory, trim = true)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

trimMethod · 0.95
isNodeInCategoryFunction · 0.90

Tested by

no test coverage detected