MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / FilterChildNodes

Method FilterChildNodes

xmlparser/node.go:43–51  ·  view source on GitHub ↗

FilterChildNodes removes all child nodes of type *Node that do not satisfy the given predicate function.

(pred func(child *Node) bool)

Source from the content-addressed store, hash-verified

41// FilterChildNodes removes all child nodes of type *Node
42// that do not satisfy the given predicate function.
43func (n *Node) FilterChildNodes(pred func(child *Node) bool) {
44 n.Children = slices.DeleteFunc(n.Children, func(child Token) bool {
45 cn, ok := child.(*Node)
46 if !ok {
47 return false
48 }
49 return !pred(cn)
50 })
51}
52
53// WriteTo writes the XML representation of the node and its children to the provided writer.
54func (n *Node) WriteTo(w TokenWriter) error {

Callers 2

sanitizeMethod · 0.80
sanitizeElementMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected