calque/src/components/textarea/spellChecker.ts
Chris Kruining 487e41c2d7
stash
2025-02-11 16:55:12 +11:00

8 lines
No EOL
297 B
TypeScript

const regex = /\w+/gi;
export function defaultChecker(subject: string, lang: string): [number, number][] {
return Array.from<RegExpExecArray>(subject.matchAll(regex)).filter(() => Math.random() >= .5).map(({ 0: match, index }) => {
return [index, index + match.length - 1];
});
}