* 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)
| 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 |
nothing calls this directly
no test coverage detected