// Code generated by goderive DO NOT EDIT.

package nodeagent

// deriveTraverse returns a list where each element of the input list has been morphed by the input function or an error.
func deriveTraverse(f func(*Dependency) (*Dependency, error), list []*Dependency) ([]*Dependency, error) {
	out := make([]*Dependency, len(list))
	var err error
	for i, elem := range list {
		out[i], err = f(elem)
		if err != nil {
			return nil, err
		}
	}
	return out, nil
}

// deriveFilter returns a list of all items in the list that matches the predicate.
func deriveFilter(predicate func(*Dependency) bool, list []*Dependency) []*Dependency {
	j := 0
	for i, elem := range list {
		if predicate(elem) {
			if i != j {
				list[j] = list[i]
			}
			j++
		}
	}
	return list[:j]
}

// deriveFmap returns a list where each element of the input list has been morphed by the input function.
func deriveFmap(f func(*Dependency) string, list []*Dependency) []string {
	out := make([]string, len(list))
	for i, elem := range list {
		out[i] = f(elem)
	}
	return out
}

// deriveAny reports whether the predicate returns true for any of the elements in the given slice.
func deriveAny(pred func(*Dependency) bool, list []*Dependency) bool {
	for _, elem := range list {
		if pred(elem) {
			return true
		}
	}
	return false
}
