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:
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.