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

Method find_pinia_setup_fn

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

Source from the content-addressed store, hash-verified

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

Callers 1

extract_variableMethod · 0.80

Calls 1

textMethod · 0.45

Tested by

no test coverage detected