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:
504 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * Extractor function for a ConditionalExpression type value node.
|
---|
| 3 | *
|
---|
| 4 | * @param - value - AST Value object with type `ConditionalExpression`
|
---|
| 5 | * @returns - The extracted value converted to correct type.
|
---|
| 6 | */
|
---|
| 7 | export default function extractValueFromConditionalExpression(value) {
|
---|
| 8 | // eslint-disable-next-line global-require
|
---|
| 9 | const getValue = require('.').default;
|
---|
| 10 | const {
|
---|
| 11 | test,
|
---|
| 12 | alternate,
|
---|
| 13 | consequent,
|
---|
| 14 | } = value;
|
---|
| 15 |
|
---|
| 16 | return getValue(test) ? getValue(consequent) : getValue(alternate);
|
---|
| 17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.