| 165 | }; |
| 166 | |
| 167 | var hasMatch = (s1, s2, s3, i, j, tabu) => { |
| 168 | const isBaseCase1 = i === 0 && j === 0; |
| 169 | if (isBaseCase1) return true; |
| 170 | |
| 171 | const isBaseCase2 = i === 0; |
| 172 | if (isBaseCase2) return getRight(i, j, s2, s3, tabu); |
| 173 | |
| 174 | const isBaseCase3 = j === 0; |
| 175 | if (isBaseCase3) return getLeft(i, j, s1, s3, tabu); |
| 176 | |
| 177 | const left = getLeft(i, j, s1, s3, tabu); |
| 178 | const right = getRight(i, j, s2, s3, tabu); |
| 179 | |
| 180 | return left || right; |
| 181 | }; |
| 182 | |
| 183 | var getLeft = (i, j, s1, s3, tabu) => |
| 184 | (tabu[i - 1][j] && s1[i - 1]) === s3[i + j - 1]; |