Skip to content

Commit

Permalink
[SpellChecker] js->ts (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Aug 21, 2020
1 parent 1fabdaf commit 5e194d6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
14 changes: 11 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/styles": "^4.10.0",
"@matt-block/react-recaptcha-v2": "^1.0.6",
"@types/nspell": "^2.1.0",
"axios": "^0.19.2",
"dictionary-en-us": "^2.1.1",
"make-dir": "^3.1.0",
Expand Down
22 changes: 0 additions & 22 deletions src/components/DataEntry/spellChecker.js

This file was deleted.

22 changes: 22 additions & 0 deletions src/components/DataEntry/spellChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import nspell from "nspell";

import aff from "../../resources/dictionaries/en-us.aff";
import dictionary from "../../resources/dictionaries/en-us.dic";

class SpellChecker {
spell: nspell;

constructor() {
this.spell = nspell(aff, dictionary);
}

correct(word: string) {
return this.spell.correct(word);
}

getSpellingSuggestions(word: string) {
return this.spell.suggest(word);
}
}

export default SpellChecker;

0 comments on commit 5e194d6

Please sign in to comment.