nl_tokens: Gets the numerical value of the given node if possible othewise returns undefined . TODO : does this work with BigNumber / Fractions / etc .
pl_tokens: function getNumericValue ( expr ) { var simplified = simplifyConstant ( expr ) ; return toNumber ( simplified ) ; function toNumber ( expr ) { if ( expr . <mask> === 'OperatorNode' && expr . op === '-' && expr . args . length === 1 ) { // Unary minus var num = toNumber ( expr . args [ 0 ] ) ; return num === undefined ? undefined : - num ; } else if ( expr . type === 'ConstantNode' && ( ! expr . valueType || expr . valueType === 'number' ) ) { return + expr . value ; } else { return undefined ; } } }