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

Version Path
immosquare-cleaner-0.1.51 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.50 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.49 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.48 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.47 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.46 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
immosquare-cleaner-0.1.45 node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js
decidim-0.26.8 packages/eslint-config/node_modules/jsx-ast-utils/src/values/expressions/CallExpression.js