node_modules/hydrolysis/lib/ast-utils/ast-value.js
/**
 * Tries to get a value from expression. Handles Literal, UnaryExpression
 * returns undefined on failure
 * valueExpression example:
 * { type: "Literal",
 */
Tries to get a value from expression. Handles Literal, UnaryExpression
returns undefined on failure
valueExpression example:
{ type: "Literal".
Tries to get a value from expression . Handles Literal UnaryExpression returns undefined on failure valueExpression example : { type : " Literal " .
function expressionToValue(valueExpression) {
  switch(valueExpression.type) {
    case 'Literal':
      return literalToValue(valueExpression);
    case 'UnaryExpression':
      return unaryToValue(valueExpression);
    case 'Identifier':
      return identifierToValue(valueExpression);
    case 'FunctionDeclaration':
      return functionDeclarationToValue(valueExpression);
    case 'FunctionExpression':
      return functionExpressionToValue(valueExpression);
    case 'ArrayExpression':
      return arrayExpressionToValue(valueExpression);
    case 'ObjectExpression':
      return objectExpressionToValue(valueExpression);
    case 'Identifier':
      return identifierToValue(valueExpression);
    case 'MemberExpression':
      return memberExpressionToValue(valueExpression);
    case 'BinaryExpression':
      return binaryExpressionToValue(valueExpression);
    default:
      return;
  }
}
function expressionToValue ( valueExpression ) { switch ( valueExpression . type ) { case 'Literal' : return literalToValue ( valueExpression ) ; case 'UnaryExpression' : return unaryToValue ( valueExpression ) ; case 'Identifier' : return identifierToValue ( valueExpression ) ; case 'FunctionDeclaration' : return functionDeclarationToValue ( valueExpression ) ; case 'FunctionExpression' : return functionExpressionToValue ( valueExpression ) ; case 'ArrayExpression' : return arrayExpressionToValue ( valueExpression ) ; case 'ObjectExpression' : return objectExpressionToValue ( valueExpression ) ; case 'Identifier' : return identifierToValue ( valueExpression ) ; case 'MemberExpression' : return memberExpressionToValue ( valueExpression ) ; case 'BinaryExpression' : return binaryExpressionToValue ( valueExpression ) ; default : return ; } }
Tries to get a value from expression.
Tries to get a value from expression .