Sha256: 1a3a339c4c5fc339420c286367d32403e2fd9b5efac921314de1dde0b6b14176
Contents?: true
Size: 680 Bytes
Versions: 43
Compression:
Stored size: 680 Bytes
Contents
/** * Extractor function for a LogicalExpression type value node. * A logical expression is `a && b` or `a || b`, so we evaluate both sides * and return the extracted value of the expression. * * @param - value - AST Value object with type `LogicalExpression` * @returns - The extracted value converted to correct type. */ export default function extractValueFromLogicalExpression(value) { // eslint-disable-next-line global-require const getValue = require('./index.js').default; const { operator, left, right } = value; const leftVal = getValue(left); const rightVal = getValue(right); return operator === '&&' ? leftVal && rightVal : leftVal || rightVal; }
Version data entries
43 entries across 43 versions & 1 rubygems