MCPcopy
hub / github.com/josdejong/mathjs / needParenthesis

Function needParenthesis

src/expression/node/AccessorNode.js:29–39  ·  view source on GitHub ↗

* Are parenthesis needed? * @private

(node)

Source from the content-addressed store, hash-verified

27 * @private
28 */
29 function needParenthesis (node) {
30 // TODO: maybe make a method on the nodes which tells whether they need parenthesis?
31 return !(
32 isAccessorNode(node) ||
33 isArrayNode(node) ||
34 isConstantNode(node) ||
35 isFunctionNode(node) ||
36 isObjectNode(node) ||
37 isParenthesisNode(node) ||
38 isSymbolNode(node))
39 }
40
41 class AccessorNode extends Node {
42 /**

Callers 3

_toStringMethod · 0.70
_toHTMLMethod · 0.70
_toTexMethod · 0.70

Calls 7

isAccessorNodeFunction · 0.90
isArrayNodeFunction · 0.90
isConstantNodeFunction · 0.90
isFunctionNodeFunction · 0.90
isObjectNodeFunction · 0.90
isParenthesisNodeFunction · 0.90
isSymbolNodeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…