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

Function indexInSlice

utilities.go:115–124  ·  view source on GitHub ↗

Returns the index of the target node in the slice, or -1.

(slice []*html.Node, node *html.Node)

Source from the content-addressed store, hash-verified

113
114// Returns the index of the target node in the slice, or -1.
115func indexInSlice(slice []*html.Node, node *html.Node) int {
116 if node != nil {
117 for i, n := range slice {
118 if n == node {
119 return i
120 }
121 }
122 }
123 return -1
124}
125
126// Appends the new nodes to the target slice, making sure no duplicate is added.
127// There is no check to the original state of the target slice, so it may still

Callers 5

IndexSelectorMethod · 0.85
IndexMatcherMethod · 0.85
IndexOfNodeMethod · 0.85
IndexOfSelectionMethod · 0.85
isInSliceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…