# node-aspell

> Node.js bindings for aspell

Latest version **1.0.0** (published 2024-10-04) · LGPL-2.1-only license · 0 weekly downloads

## Install

```sh
npm install node-aspell
pnpm add node-aspell
yarn add node-aspell
bun add node-aspell
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-10-04 |
| First published | 2019-11-21 |
| Weekly downloads | 0 |
| License | LGPL-2.1-only |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18.0.0 |
| Dependencies | 1 |
| Unpacked size | 42.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Maintainers | epotocko |
| Keywords | aspell, spell check, spell checker |

## Links

- npm: https://www.npmjs.com/package/node-aspell
- Repository: https://github.com/epotocko/node-aspell
- Homepage: https://github.com/epotocko/node-aspell#readme
- Issues: https://github.com/epotocko/node-aspell/issues
- npm.io page: https://npm.io/package/node-aspell

## Dependencies (1)

- [node-addon-api](https://npm.io/package/node-addon-api.md) ^8.1.0

## Recent versions

- 1.0.0 (latest) — 2024-10-04
- 0.4.0 — 2024-10-04
- 0.3.0 — 2023-09-14
- 0.2.3 — 2020-04-22
- 0.2.1 — 2019-11-21
- 0.2.0 — 2019-11-21

## README

# aspell Node Module

Native bindings to [aspell](http://aspell.net/) spell checking library for Node.js.

Node.js v18+ are compatible with this version of node-aspell

## Installation
```bash
npm install node-aspell
```

## Usage

```javascript
const spellChecker = require('node-aspell');
console.log(spellChecker.isMisspelled("pncils"));
console.log(spellChecker.getCorrectionsForMisspelling("pncils"));
```

### spellChecker.isMisspelled(word)

Check if a word is misspelled.

`word` - String word to check.

Returns `true` if the word is misspelled, `false` otherwise.

### spellChecker.isMisspelledAsync(word, callback)

Check if a word is misspelled asynchronously.

`word` - String word to check.

`callback` - Function to call with result callback(err, misspelled)

### spellChecker.getCorrectionsForMisspelling(word)

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.

### spellChecker.getCorrectionsForMisspellingAsync(word, callback)

Get the corrections for a misspelled word asynchronously.

`word` - String word to get corrections for.

`callback` - Function to call with result

### new Spellchecker(options)

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 language/dictionary can be changed independently from the default instance. See the aspell options documentation for a full list of options: http://aspell.net/man-html/The-Options.html

```javascript
const checker = new SpellChecker.Spellchecker({ lang: "es", encoding: "utf-8" });
const checker = new SpellChecker.Spellchecker({
	'master': 'es.rws',
	'dict-dir': '/var/lib/aspell',
	'encoding': 'utf-8'
});
const checker = new SpellChecker.Spellchecker("en_US");
```

## Unit Tests

Sample Dockerfile for running unit tests:
```
FROM node:xx
RUN apt-get update && apt-get install -y aspell aspell-en aspell-es libaspell-dev
COPY . /module
WORKDIR /module
RUN npm install && npm run-script build
RUN npm test
```

## Alternatives
These packages spawn a separate aspell process and parse the output:

[aspell](https://www.npmjs.com/package/aspell)

[aspell-stream](https://www.npmjs.com/package/aspell-stream)

---
_Source: https://npm.io/package/node-aspell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
