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

Function customFunction

test/unit-tests/expression/node/RangeNode.test.js:296–304  ·  view source on GitHub ↗
(node, options)

Source from the content-addressed store, hash-verified

294 it('should stringify a RangeNode with custom toString', function () {
295 // Also checks if the custom functions get passed on to the children
296 const customFunction = function (node, options) {
297 if (node.type === 'RangeNode') {
298 return 'from ' + node.start.toString(options) +
299 ' to ' + node.end.toString(options) +
300 ' with steps of ' + node.step.toString(options)
301 } else if (node.type === 'ConstantNode') {
302 return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')'
303 }
304 }
305
306 const a = new ConstantNode(1)
307 const b = new ConstantNode(2)

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…