MCPcopy Index your code
hub / github.com/josdejong/mathjs / customFunction

Function customFunction

test/unit-tests/expression/node/IndexNode.test.js:209–217  ·  view source on GitHub ↗
(node, options)

Source from the content-addressed store, hash-verified

207 it('should stringify an IndexNode with custom toString', function () {
208 // Also checks if the custom functions get passed on to the children
209 const customFunction = function (node, options) {
210 if (node.type === 'IndexNode') {
211 return node.dimensions.map(function (range) {
212 return range.toString(options)
213 }).join(', ')
214 } else if (node.type === 'ConstantNode') {
215 return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')'
216 }
217 }
218
219 const b = new ConstantNode(1)
220 const c = new ConstantNode(2)

Callers

nothing calls this directly

Calls 5

mapMethod · 0.65
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…