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

Method map

src/expression/node/BlockNode.js:96–108  ·  view source on GitHub ↗

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

(callback)

Source from the content-addressed store, hash-verified

94 * @returns {BlockNode} Returns a transformed copy of the node
95 */
96 map (callback) {
97 const blocks = []
98 for (let i = 0; i < this.blocks.length; i++) {
99 const block = this.blocks[i]
100 const node = this._ifNode(
101 callback(block.node, 'blocks[' + i + '].node', this))
102 blocks[i] = {
103 node,
104 visible: block.visible
105 }
106 }
107 return new BlockNode(blocks)
108 }
109
110 /**
111 * 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