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

Function customFunction

test/unit-tests/expression/node/AssignmentNode.test.js:493–501  ·  view source on GitHub ↗
(node, options)

Source from the content-addressed store, hash-verified

491 it('should stringify an AssignmentNode with custom toString', function () {
492 // Also checks if custom funcions get passed to the children
493 const customFunction = function (node, options) {
494 if (node.type === 'AssignmentNode') {
495 return node.object.toString(options) +
496 (node.index ? node.index.toString(options) : '') +
497 ' equals ' + node.value.toString(options)
498 } else if (node.type === 'ConstantNode') {
499 return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')'
500 }
501 }
502
503 const object = new SymbolNode('a')
504 const value = new ConstantNode(1)

Callers

nothing calls this directly

Calls 4

toStringMethod · 0.65
typeOfMethod · 0.65
toHTMLMethod · 0.65
toTexMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…