Permalink
Cannot retrieve contributors at this time
21 lines (20 sloc)
756 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/jsx-ast-utils/lib/values/expressions/OptionalCallExpression.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = extractValueFromOptionalCallExpression; | |
/** | |
* Extractor function for a OptionalCallExpression type value node. | |
* A member expression is accessing a property on an object `obj.property` and invoking it. | |
* | |
* @param - value - AST Value object with type `OptionalCallExpression` | |
* @returns - The extracted value converted to correct type | |
* and maintaing `obj.property?.()` convention. | |
*/ | |
function extractValueFromOptionalCallExpression(value) { | |
// eslint-disable-next-line global-require | |
var getValue = require('.').default; | |
return getValue(value.callee) + '?.(' + value.arguments.map(function (x) { | |
return getValue(x); | |
}).join(', ') + ')'; | |
} |