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

Method map

src/expression/node/AssignmentNode.js:219–227  ·  view source on GitHub ↗

* Create a new AssignmentNode 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 {AssignmentNode} Returns a transformed copy of the node

(callback)

Source from the content-addressed store, hash-verified

217 * @returns {AssignmentNode} Returns a transformed copy of the node
218 */
219 map (callback) {
220 const object = this._ifNode(callback(this.object, 'object', this))
221 const index = this.index
222 ? this._ifNode(callback(this.index, 'index', this))
223 : null
224 const value = this._ifNode(callback(this.value, 'value', this))
225
226 return new AssignmentNode(object, index, value)
227 }
228
229 /**
230 * 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