UNPKG

nodehun

Version:

The Hunspell binding for nodejs that exposes as much of hunspell as possible and also adds new features. Hunspell is a first class spellcheck library used by Google, Apple, and Mozilla.

31 lines (24 loc) 731 B
const Nodehun = require('bindings')('Nodehun') const dictionaries = require('./dictionaries') const nodehun = new Nodehun(dictionaries.en_US.affix, dictionaries.en_US.dictionary) /** * Async : using the promise */ nodehun .analyze('telling') .then(analysis => { console.log(analysis) // => [' st:telling ts:0', ' st:tell ts:0 al:told is:Vg'] }) /** * Async : using async/await */ async function analyze() { const analysis = await nodehun.analyze('telling') console.log(analysis) // => [' st:telling ts:0', ' st:tell ts:0 al:told is:Vg'] } analyze() /** * Sync */ const analysis = nodehun.analyzeSync('telling') console.log(analysis) // => [' st:telling ts:0', ' st:tell ts:0 al:told is:Vg']