Sha256: 623f2061796f884ca7eb9fbfa608ca293f7d9dff5c25a90a99c3387b5f071425
Contents?: true
Size: 705 Bytes
Versions: 8
Compression:
Stored size: 705 Bytes
Contents
/** * Extractor function for a CallExpression type value node. * A call expression looks like `bar()` * This will return `bar` as the value to indicate its existence, * since we can not execute the function bar in a static environment. * * @param - value - AST Value object with type `CallExpression` * @returns - The extracted value converted to correct type. */ export default function extractValueFromCallExpression(value) { // eslint-disable-next-line global-require const getValue = require('.').default; const args = Array.isArray(value.arguments) ? value.arguments.map((x) => getValue(x)).join(', ') : ''; return `${getValue(value.callee)}${value.optional ? '?.' : ''}(${args})`; }
Version data entries
8 entries across 8 versions & 2 rubygems