MCPcopy
hub / github.com/philc/vimium / get

Function get

background_scripts/completion/ranking.js:151–164  ·  view source on GitHub ↗
(string, prefix, suffix)

Source from the content-addressed store, hash-verified

149 // a word)
150 // TODO: `prefix` and `suffix` might be useful in richer word-relevancy scoring.
151 get(string, prefix, suffix) {
152 if (prefix == null) prefix = "";
153 if (suffix == null) suffix = "";
154 if (!this.initialized) this.init();
155 let regexpString = Utils.escapeRegexSpecialCharacters(string);
156 // Avoid cost of constructing new strings if prefix/suffix are empty (which is expected to be a
157 // common case).
158 if (prefix) regexpString = prefix + regexpString;
159 if (suffix) regexpString = regexpString + suffix;
160 // Smartcase: Regexp is case insensitive, unless `string` contains a capital letter (testing
161 // `string`, not `regexpString`).
162 return this.cache[regexpString] ||
163 (this.cache[regexpString] = new RegExp(regexpString, Utils.hasUpperCase(string) ? "" : "i"));
164 },
165};

Callers

nothing calls this directly

Calls 1

initMethod · 0.45

Tested by

no test coverage detected