(body, variableName)
| 200 | } |
| 201 | |
| 202 | function getVariableDetails(body, variableName) { |
| 203 | return body.filter((node) => { |
| 204 | if (node.type === 'VariableDeclaration') { |
| 205 | return true |
| 206 | } |
| 207 | return false |
| 208 | }).reduce((acc, node) => { |
| 209 | const { declarations } = node |
| 210 | // console.log('declarations', declarations) |
| 211 | if (declarations) { |
| 212 | declarations.forEach((dec) => { |
| 213 | if (getName(dec) === variableName) { |
| 214 | if (dec.init && dec.init.properties) { |
| 215 | acc = acc.concat(dec.init.properties) |
| 216 | } |
| 217 | } |
| 218 | }) |
| 219 | } |
| 220 | return acc |
| 221 | }, []) |
| 222 | } |
| 223 | |
| 224 | function getFunctionDetails(body, functionName) { |
| 225 | return body.filter((node) => { |
no test coverage detected