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

Method map

src/expression/node/OperatorNode.js:353–360  ·  view source on GitHub ↗

* Create a new OperatorNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {OperatorNode} Returns a transformed copy of the node

(callback)

Source from the content-addressed store, hash-verified

351 * @returns {OperatorNode} Returns a transformed copy of the node
352 */
353 map (callback) {
354 const args = []
355 for (let i = 0; i < this.args.length; i++) {
356 args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this))
357 }
358 return new OperatorNode(
359 this.op, this.fn, args, this.implicit, this.isPercentage)
360 }
361
362 /**
363 * Create a clone of this node, a shallow copy

Callers

nothing calls this directly

Calls 2

_ifNodeMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected