( word: string, locale: string, minLength: number, enableStopwords: boolean, isStopwordFn: (word: string, locale: string) => boolean )
| 122 | * 判断是否为有效词语 |
| 123 | */ |
| 124 | export function isValidWord( |
| 125 | word: string, |
| 126 | locale: string, |
| 127 | minLength: number, |
| 128 | enableStopwords: boolean, |
| 129 | isStopwordFn: (word: string, locale: string) => boolean |
| 130 | ): boolean { |
| 131 | if (!word || word.trim().length === 0) return false |
| 132 | if (PURE_NUMBER_REGEX.test(word)) return false |
| 133 | if (word.length < minLength) return false |
| 134 | if (enableStopwords && isStopwordFn(word, locale)) return false |
| 135 | return true |
| 136 | } |
no outgoing calls
no test coverage detected