97
98
export function matchesSubString(word: string, wordToMatchAgainst: string): IMatch[] | null {
99
>
if (word.length > wordToMatchAgainst.length) {
filters.ts
100
return null;
101
}
103
>
return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0);
104
>
}
105
106
>
function _matchesSubString(word: string, wordToMatchAgainst: string, i: number, j: number): IMatch[] | null {
filters.ts
107
>
if (i === word.length) {
108
return [];
109
>
} else if (j === wordToMatchAgainst.length) {
filters.ts
110
return null;
112
>
if (word[i] === wordToMatchAgainst[j]) {
113
>
let result: IMatch[] | null = null;
114
>
if (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) {
115
return join({ start: j, end: j + 1 }, result);
116
}
117
return null;
118
}
120
>
return _matchesSubString(word, wordToMatchAgainst, i, j + 1);
121
>
}
122
>
}
123
124
// CamelCase