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

Method find_pinia_setup_fn

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

Source from the content-addressed store, hash-verified

1331 }
1332
1333 fn find_pinia_setup_fn(&self, call: Node<'t>) -> Option<Node<'t>> {
1334 let callee = call.child_by_field_name("function")?;
1335 if callee.kind() != "identifier" || self.text(callee) != "defineStore" {
1336 return None;
1337 }
1338 let args = call.child_by_field_name("arguments")?;
1339 for i in 0..args.named_child_count() {
1340 let Some(arg) = args.named_child(i) else { continue };
1341 if !matches!(arg.kind(), "arrow_function" | "function_expression") {
1342 continue;
1343 }
1344 if let Some(body) = arg.child_by_field_name("body") {
1345 if body.kind() == "statement_block" {
1346 return Some(arg);
1347 }
1348 }
1349 }
1350 None
1351 }
1352
1353 fn extract_pinia_setup_body(&mut self, setup: Node<'t>) {
1354 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