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

Method find_pinia_setup_fn

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

Source from the content-addressed store, hash-verified

755 }
756
757 fn find_pinia_setup_fn(&self, call: Node<'t>) -> Option<Node<'t>> {
758 let callee = call.child_by_field_name("function")?;
759 if callee.kind() != "identifier" || self.text(callee) != "defineStore" {
760 return None;
761 }
762 let args = call.child_by_field_name("arguments")?;
763 for i in 0..args.named_child_count() {
764 let Some(arg) = args.named_child(i) else { continue };
765 if !matches!(arg.kind(), "arrow_function" | "function_expression") {
766 continue;
767 }
768 if let Some(body) = arg.child_by_field_name("body") {
769 if body.kind() == "statement_block" {
770 return Some(arg);
771 }
772 }
773 }
774 None
775 }
776
777 fn extract_pinia_setup_body(&mut self, setup: Node<'t>) {
778 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