MCPcopy Create free account
hub / github.com/DavidWells/analytics / getFunctionDetails

Function getFunctionDetails

scripts/docs/parse/index.js:224–240  ·  view source on GitHub ↗
(body, functionName)

Source from the content-addressed store, hash-verified

222}
223
224function getFunctionDetails(body, functionName) {
225 return body.filter((node) => {
226 // console.log('getFunctionDetails', node)
227 if (node.type === 'FunctionDeclaration' || node.type === 'ExportDefaultDeclaration') {
228 return getName(node) === functionName
229 }
230 return false
231 }).reduce((acc, node) => {
232 const body = getBody(node)
233 if (body) {
234 const lookupBody = body.body || body // verify this logic
235 const foundThings = getReturnStatment(lookupBody)
236 acc = acc.concat(foundThings)
237 }
238 return acc
239 }, [])
240}
241
242function getBody(node) {
243 if (node.type === 'ExportDefaultDeclaration') {

Callers 1

getMethodsReturnedFunction · 0.85

Calls 3

getBodyFunction · 0.85
getReturnStatmentFunction · 0.85
getNameFunction · 0.70

Tested by

no test coverage detected