* 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)
| 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 |