MCPcopy
hub / github.com/PuerkitoBio/goquery / mapNodes

Function mapNodes

traversal.go:696–704  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

694// Returns an array of nodes mapped by calling the callback function once for
695// each node in the source nodes.
696func 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}

Callers 8

FindNodesMethod · 0.85
ClosestMatcherMethod · 0.85
ClosestNodesMethod · 0.85
findWithMatcherFunction · 0.85
getParentsNodesFunction · 0.85
getSiblingNodesFunction · 0.85
getChildrenNodesFunction · 0.85
getParentNodesFunction · 0.85

Calls 1

appendWithoutDuplicatesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…