main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
851 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = extractValueFromCallExpression;
|
---|
7 | /**
|
---|
8 | * Extractor function for a CallExpression type value node.
|
---|
9 | * A call expression looks like `bar()`
|
---|
10 | * This will return `bar` as the value to indicate its existence,
|
---|
11 | * since we can not execute the function bar in a static environment.
|
---|
12 | *
|
---|
13 | * @param - value - AST Value object with type `CallExpression`
|
---|
14 | * @returns - The extracted value converted to correct type.
|
---|
15 | */
|
---|
16 | function extractValueFromCallExpression(value) {
|
---|
17 | // eslint-disable-next-line global-require
|
---|
18 | var getValue = require('.').default;
|
---|
19 | var args = Array.isArray(value.arguments) ? value.arguments.map(function (x) {
|
---|
20 | return getValue(x);
|
---|
21 | }).join(', ') : '';
|
---|
22 | return '' + getValue(value.callee) + (value.optional ? '?.' : '') + '(' + args + ')';
|
---|
23 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.