Skip to content
SpellChecker Node Module
C++ CoffeeScript Objective-C++ Python JavaScript Objective-C C
Branch: master
Clone or download
Latest commit a03caf3 Jul 29, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Control the use of a system or Hunspell checker via API. Jul 24, 2019
src Control the use of a system or Hunspell checker via API. Jul 24, 2019
vendor Ship hunspell. Oct 15, 2013
.gitignore Checking files uses the encoding of the Hunspell dictionary file. Dec 22, 2018
.npmignore npm ignore CI files Feb 18, 2015
.travis.yml Add Node v12 to CI tests and remove Node v6 Jun 6, 2019 Add May 1, 2013 Control the use of a system or Hunspell checker via API. Jul 24, 2019
appveyor.yml Remove Node v12 tests from appveyor Jun 6, 2019
binding.gyp Build with C++11 flags Jun 29, 2017
package-lock.json 3.7.0 Jul 29, 2019
package.json 3.7.0 Jul 29, 2019

SpellChecker Node Module Build Status Build status

Native bindings to NSSpellChecker, Hunspell, or the Windows 8 Spell Check API, depending on your platform. Windows 7 and below as well as Linux will rely on Hunspell.


npm install spellchecker


SpellChecker = require 'spellchecker'


Check if a word is misspelled.

word - String word to check.

Returns true if the word is misspelled, false otherwise.


Get the corrections for a misspelled word.

word - String word to get corrections for.

Returns a non-null but possibly empty array of string corrections.


Identify misspelled words in a corpus of text.

corpus - String corpus of text to spellcheck.

Returns an Array containing {start, end} objects that describe an index range within the original String that contains a misspelled word.


Asynchronously identify misspelled words.

corpus - String corpus of text to spellcheck.

Returns a Promise that resolves with the Array described by checkSpelling().


Adds a word to the dictionary. When using Hunspell, this will not modify the .dic file; new words must be added each time the spellchecker is created. Use a custom dictionary file.

word - String word to add.

Returns nothing.

new Spellchecker()

In addition to the above functions that are used on a default instance, a new instance of SpellChecker can be instantiated with the use of the new operator. The same methods are available with the instance but the dictionary and underlying API can be changed independently from the default instance.

const checker = new SpellChecker.Spellchecker()


Overrides the library selection for checking. Without this, the checker will use Hunspell on Linux, the Spell Checking API for Windows, and NSSpellChecker on Macs.

If the environment variable SPELLCHECKER_PREFER_HUNSPELL is set to any value, the library will fallback to always using the Hunspell implementation.

This is the same behavior as calling setSpellcheckerType with the USE_SYSTEM_DEFAULTS constant:

checker = new SpellChecker.Spellchecker
checker.setSpellcheckerType SpellChecker.USE_SYSTEM_DEFAULTS

To always use the system API and not fallback to Hunspell regardless of the environment variable, use the ALWAYS_USE_SYSTEM constant:

checker = new SpellChecker.Spellchecker
checker.setSpellcheckerType SpellChecker.ALWAYS_USE_SYSTEM

Likewise, Hunspell can be forced with the ALWAYS_USE_HUNSPELL constant.

const checker = new SpellChecker.Spellchecker();

On Linux, Hunspell is always used regardless of the setting. This method must also be called before any spelling is done otherwise it will throw an error.

This returns nothing.

You can’t perform that action at this time.