typo-js
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/typo-js package

1.2.5 • Public • Published

Typo.js is a JavaScript/TypeScript spellchecker that uses Hunspell-style dictionaries.

Usage

To use Typo, simply load it like so:

var Typo = require("typo-js");
var dictionary = new Typo(lang_code);

Typo includes by default a dictionary for the en_US lang_code.

To check if a word is spelled correctly, do this:

var is_spelled_correctly = dictionary.check("mispelled");

To get suggested corrections for a misspelled word, do this:

var array_of_suggestions = dictionary.suggest("mispeling");

// array_of_suggestions == ["misspelling", "dispelling", "misdealing", "misfiling", "misruling"]

Typo.js has full support for the following Hunspell affix flags:

  • PFX
  • SFX
  • REP
  • FLAG
  • COMPOUNDMIN
  • COMPOUNDRULE
  • ONLYINCOMPOUND
  • KEEPCASE
  • NOSUGGEST
  • NEEDAFFIX

Development

The full TypeScript source code and unit test suites are available in the official Typo.js repository at https://github.com/cfinke/Typo.js

To modify Typo.js, make your changes to ts/typo.ts and then run build.sh to generate the JavaScript file typo/typo.js.

Licensing

Typo.js is free software, licensed under the Modified BSD License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.516,590latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.516,590
1.2.434,619
1.2.315,895
1.2.218,156
1.2.17,208
1.2.05,001
1.1.01,549
1.0.31,710
1.0.2430
1.0.11
1.0.05

Package Sidebar

Install

npm i typo-js

Weekly Downloads

22,034

Version

1.2.5

License

BSD-3-Clause

Unpacked Size

741 kB

Total Files

6

Last publish

Collaborators

  • cfinke