|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
504 bytes
|
| Line | |
|---|
| 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.