source: imaps-frontend/node_modules/jsx-ast-utils/src/values/expressions/ConditionalExpression.js@ d565449

main
Last change on this file since d565449 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
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 */
7export 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.