Internal map function used by many traversing methods. Takes the source nodes to iterate on and the mapping function that returns an array of nodes. Returns an array of nodes mapped by calling the callback function once for each node in the source nodes.
(nodes []*html.Node, f func(int, *html.Node) []*html.Node)
| 694 | // Returns an array of nodes mapped by calling the callback function once for |
| 695 | // each node in the source nodes. |
| 696 | func mapNodes(nodes []*html.Node, f func(int, *html.Node) []*html.Node) (result []*html.Node) { |
| 697 | set := make(map[*html.Node]bool) |
| 698 | for i, n := range nodes { |
| 699 | if vals := f(i, n); len(vals) > 0 { |
| 700 | result = appendWithoutDuplicates(result, vals, set) |
| 701 | } |
| 702 | } |
| 703 | return result |
| 704 | } |
no test coverage detected
searching dependent graphs…