(answer: string, question: string)
| 38 | } |
| 39 | |
| 40 | export function echoAnswer(answer: string, question: string): boolean { |
| 41 | const words = wordsOf(answer); |
| 42 | if (!words.length) return false; |
| 43 | const asked = wordsOf(question).map(word => word.toLowerCase().replace(/`/g, '')); |
| 44 | const content = words.filter(word => { |
| 45 | const lower = word.toLowerCase().replace(/`/g, ''); |
| 46 | return !STOP.has(lower) && !YES_NO.has(lower) && !asked.some(other => same(lower, other)); |
| 47 | }); |
| 48 | if (content.some(codeShaped)) return false; |
| 49 | if (RESTATEMENT.test(answer)) return content.length < RESTATED_WORDS; |
| 50 | return content.length === 0 && !words.some(word => YES_NO.has(word.toLowerCase())); |
| 51 | } |
no test coverage detected