MCPcopy Index your code
hub / github.com/philc/vimium / getUrl

Method getUrl

background_scripts/completion/search_wrapper.js:17–36  ·  view source on GitHub ↗
(queryTerms)

Source from the content-addressed store, hash-verified

15 }
16
17 getUrl(queryTerms) {
18 // This tests whether @searchUrl contains something of the form "...=abc+def+%s...", from which
19 // we extract a prefix of the form "abc def ".
20 if (/\=.+\+%s/.test(this.searchUrl)) {
21 let terms = this.searchUrl.replace(/\+%s.*/, "");
22 terms = terms.replace(/.*=/, "");
23 terms = terms.replace(/\+/g, " ");
24
25 queryTerms = [...terms.split(" "), ...queryTerms];
26 const prefix = `${terms} `;
27
28 this.transformSuggestionsFn = (suggestions) => {
29 return suggestions
30 .filter((s) => s.startsWith(prefix))
31 .map((s) => s.slice(prefix.length));
32 };
33 }
34
35 return this.engine.getUrl(queryTerms);
36 }
37
38 parse(responseText) {
39 const suggestions = this.engine.parse(responseText);

Callers 1

completeFunction · 0.95

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected