web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
666 B

  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = extractValueFromConditionalExpression;
  6. /**
  7. * Extractor function for a ConditionalExpression type value node.
  8. *
  9. * @param - value - AST Value object with type `ConditionalExpression`
  10. * @returns - The extracted value converted to correct type.
  11. */
  12. function extractValueFromConditionalExpression(value) {
  13. // eslint-disable-next-line global-require
  14. var getValue = require('./index.js').default;
  15. var test = value.test,
  16. alternate = value.alternate,
  17. consequent = value.consequent;
  18. return getValue(test) ? getValue(consequent) : getValue(alternate);
  19. }