src/rsql.js
function getChildRsql (perhapsWrap, constraint) {
  const rsql = getRsqlFromConstraint(constraint)
  if (constraint.operands && constraint.operands.length === 1) {
    // Skip this node, render the only child node
    return getChildRsql(perhapsWrap, constraint.operands[0])
  }
  if (perhapsWrap && constraint.operator === 'OR') {
    if (constraint.operands.length > 1) {
      return `(${rsql})`
    }
  }
  return rsql
}
function getChildRsql (perhapsWrap, constraint) {
  const rsql = getRsqlFromConstraint(constraint)
  if (constraint.operands && constraint.operands.length === 1) {
    // Skip this node, render the only child node
    return getChildRsql(perhapsWrap, constraint.operands[0])
  }
  if (perhapsWrap && constraint.operator === 'OR') {
    if (constraint.operands.length > 1) {
      return `(${rsql})`
    }
  }
  return rsql
}
function getChildRsql ( perhapsWrap , constraint ) { const rsql = getRsqlFromConstraint ( constraint ) if ( constraint . operands && constraint . operands . length === 1 ) { // Skip this node, render the only child node return getChildRsql ( perhapsWrap , constraint . operands [ 0 ] ) } if ( perhapsWrap && constraint . operator === 'OR' ) { if ( constraint . operands . length > 1 ) { return ` ${ rsql } ` } } return rsql }
Transforms a constraint to rsql, and wraps it in brackets if needed.

Brackets are needed if the precedence of the operator in the subtree has lower precedence than the operator of the parent.
The rsql comparison operators all have higher precedence than the AND and OR operators so a simple constraint never
needs to be wrapped.
The OR operator has lower precedence than the AND operator so an OR constraint with more than one operand and an
AND parent needs to be wrapped.

@param perhapsWrap The child constraint may need to be wrapped
@param constraint the child constraint to transform to rsql
@returns {string}
Transforms a constraint to rsql and wraps it in brackets if needed .