45
export const matchesPrefix: IFilter = _matchesPrefix.bind(undefined, true);
46
47
>
function _matchesPrefix(ignoreCase: boolean, word: string, wordToMatchAgainst: string): IMatch[] | null {
filters.ts
48
>
if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {
49
return null;
50
}
52
>
let matches: boolean;
53
>
if (ignoreCase) {
54
matches = strings.startsWithIgnoreCase(wordToMatchAgainst, word);
56
matches = wordToMatchAgainst.indexOf(word) === 0;
57
}
59
>
if (!matches) {
60
return null;
61
}
62
63
>
return word.length > 0 ? [{ start: 0, end: word.length }] : [];
filters.ts
64
>
}
65
66
// Contiguous Substring