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

Method map

src/expression/node/ObjectNode.js:99–109  ·  view source on GitHub ↗

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

(callback)

Source from the content-addressed store, hash-verified

97 * @returns {ObjectNode} Returns a transformed copy of the node
98 */
99 map (callback) {
100 const properties = {}
101 for (const key in this.properties) {
102 if (hasOwnProperty(this.properties, key)) {
103 properties[key] = this._ifNode(
104 callback(
105 this.properties[key], 'properties[' + stringify(key) + ']', this))
106 }
107 }
108 return new ObjectNode(properties)
109 }
110
111 /**
112 * Create a clone of this node, a shallow copy

Callers

nothing calls this directly

Calls 4

hasOwnPropertyFunction · 0.90
stringifyFunction · 0.90
_ifNodeMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected