|
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:
657 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = extractValueFromConditionalExpression;
|
|---|
| 7 | /**
|
|---|
| 8 | * Extractor function for a ConditionalExpression type value node.
|
|---|
| 9 | *
|
|---|
| 10 | * @param - value - AST Value object with type `ConditionalExpression`
|
|---|
| 11 | * @returns - The extracted value converted to correct type.
|
|---|
| 12 | */
|
|---|
| 13 | function extractValueFromConditionalExpression(value) {
|
|---|
| 14 | // eslint-disable-next-line global-require
|
|---|
| 15 | var getValue = require('.').default;
|
|---|
| 16 | var test = value.test,
|
|---|
| 17 | alternate = value.alternate,
|
|---|
| 18 | consequent = value.consequent;
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | return getValue(test) ? getValue(consequent) : getValue(alternate);
|
|---|
| 22 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.