MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / find_pinia_setup_fn

Method find_pinia_setup_fn

codegraph-kernel/src/tsjs/extractors.rs:1471–1489  ·  view source on GitHub ↗
(&self, call: Node<'t>)

Source from the content-addressed store, hash-verified

1469 }
1470
1471 fn find_pinia_setup_fn(&self, call: Node<'t>) -> Option<Node<'t>> {
1472 let callee = call.child_by_field_name("function")?;
1473 if callee.kind() != "identifier" || self.text(callee) != "defineStore" {
1474 return None;
1475 }
1476 let args = call.child_by_field_name("arguments")?;
1477 for i in 0..args.named_child_count() {
1478 let Some(arg) = args.named_child(i) else { continue };
1479 if !matches!(arg.kind(), "arrow_function" | "function_expression") {
1480 continue;
1481 }
1482 if let Some(body) = arg.child_by_field_name("body") {
1483 if body.kind() == "statement_block" {
1484 return Some(arg);
1485 }
1486 }
1487 }
1488 None
1489 }
1490
1491 fn extract_pinia_setup_body(&mut self, setup: Node<'t>) {
1492 let Some(body) = setup.child_by_field_name("body") else { return };

Callers 1

extract_variableMethod · 0.80

Calls 1

textMethod · 0.65

Tested by

no test coverage detected