* Returns true if the expression starts with a constant, under * the current parenthesization: * @param {Node} expression * @param {string} parenthesis * @return {boolean}
(expr, parenthesis)
| 21 | * @return {boolean} |
| 22 | */ |
| 23 | function startsWithConstant (expr, parenthesis) { |
| 24 | let curNode = expr |
| 25 | if (parenthesis === 'auto') { |
| 26 | while (isParenthesisNode(curNode)) curNode = curNode.content |
| 27 | } |
| 28 | if (isConstantNode(curNode)) return true |
| 29 | if (isOperatorNode(curNode)) { |
| 30 | return startsWithConstant(curNode.args[0], parenthesis) |
| 31 | } |
| 32 | return false |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Calculate which parentheses are necessary. Gets an OperatorNode |
no test coverage detected
searching dependent graphs…