MCPcopy Create free account
hub / github.com/003random/getJS / Filter

Function Filter

extractor/extractor.go:71–89  ·  view source on GitHub ↗

Filter applies options to filter URLs from the input channel.

(input <-chan url.URL, options ...func([]url.URL) []url.URL)

Source from the content-addressed store, hash-verified

69
70// Filter applies options to filter URLs from the input channel.
71func Filter(input <-chan url.URL, options ...func([]url.URL) []url.URL) (<-chan url.URL, error) {
72 output := make(chan url.URL)
73 go func() {
74 defer close(output)
75 var urls []url.URL
76 for u := range input {
77 urls = append(urls, u)
78 }
79
80 for _, option := range options {
81 urls = option(urls)
82 }
83
84 for _, u := range urls {
85 output <- u
86 }
87 }()
88 return output, nil
89}
90
91// WithComplete is an option to complete relative URLs.
92func WithComplete(base *url.URL) func([]url.URL) []url.URL {

Callers 2

ProcessURLsMethod · 0.92
ProcessResponseMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected