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

Function customFunction

test/unit-tests/expression/node/OperatorNode.test.js:373–381  ·  view source on GitHub ↗
(node, options)

Source from the content-addressed store, hash-verified

371 it('should stringify an OperatorNode with custom toString', function () {
372 // Also checks if the custom functions get passed on to the children
373 const customFunction = function (node, options) {
374 if (node.type === 'OperatorNode') {
375 return node.op + node.fn + '(' +
376 node.args[0].toString(options) +
377 ', ' + node.args[1].toString(options) + ')'
378 } else if (node.type === 'ConstantNode') {
379 return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')'
380 }
381 }
382
383 const n2 = new OperatorNode('-', 'subtract', [one, two])
384

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…