* Create a new FunctionNode 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 {FunctionNode} Returns a transformed copy of the node
(callback)
| 323 | * @returns {FunctionNode} Returns a transformed copy of the node |
| 324 | */ |
| 325 | map (callback) { |
| 326 | const fn = this._ifNode(callback(this.fn, 'fn', this)) |
| 327 | const args = [] |
| 328 | for (let i = 0; i < this.args.length; i++) { |
| 329 | args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this)) |
| 330 | } |
| 331 | return new FunctionNode(fn, args) |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * Create a clone of this node, a shallow copy |