packages/solver/lib/util/removeUnnecessaryParens.js
function removeUnnecessaryParens(node, rootNode=false) {
  // Parens that wrap everything are redundant.
  // NOTE: removeUnnecessaryParensSearch recursively removes parens that aren't
  // needed, while this step only applies to the very top level expression.
  // e.g. (2 + 3) * 4 can't become 2 + 3 * 4, but if (2 + 3) as a top level
  // expression can become 2 + 3
  if (rootNode) {
    while (Node.Type.isParenthesis(node)) {
      node = node.content;
    }
  }
  return removeUnnecessaryParensSearch(node);
}
function removeUnnecessaryParens(node, rootNode=false) {
  // Parens that wrap everything are redundant.
  // NOTE: removeUnnecessaryParensSearch recursively removes parens that aren't
  // needed, while this step only applies to the very top level expression.
  // e.g. (2 + 3) * 4 can't become 2 + 3 * 4, but if (2 + 3) as a top level
  // expression can become 2 + 3
  if (rootNode) {
    while (Node.Type.isParenthesis(node)) {
      node = node.content;
    }
  }
  return removeUnnecessaryParensSearch(node);
}
function removeUnnecessaryParens ( node , rootNode = false ) { // Parens that wrap everything are redundant. // NOTE: removeUnnecessaryParensSearch recursively removes parens that aren't // needed, while this step only applies to the very top level expression. // e.g. (2 + 3) * 4 can't become 2 + 3 * 4, but if (2 + 3) as a top level // expression can become 2 + 3 if ( rootNode ) { while ( Node . Type . isParenthesis ( node ) ) { node = node . content ; } } return removeUnnecessaryParensSearch ( node ) ; }
Removes any parenthesis around nodes that can't be resolved further. Input must be a top level expression. Returns a node.
Removes any parenthesis around nodes that can t be resolved further . Input must be a top level expression . Returns a node .