dictionary-en
Advanced tools
Comparing version 3.1.0 to 3.2.0
18
index.js
@@ -1,3 +0,3 @@ | ||
var read = require('fs').readFile | ||
var join = require('path').join | ||
const fs = require('fs') | ||
const path = require('path') | ||
@@ -7,5 +7,5 @@ module.exports = load | ||
function load(callback) { | ||
var pos = -1 | ||
var exception = null | ||
var result = {} | ||
let result = {} | ||
let pos = -1 | ||
let exception | ||
@@ -16,3 +16,3 @@ one('aff') | ||
function one(name) { | ||
read(join(__dirname, 'index.' + name), function (error, doc) { | ||
fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { | ||
pos++ | ||
@@ -23,5 +23,5 @@ exception = exception || error | ||
if (pos) { | ||
callback(exception, exception ? null : result) | ||
exception = null | ||
result = null | ||
callback(exception, exception ? undefined : result) | ||
exception = undefined | ||
result = undefined | ||
} | ||
@@ -28,0 +28,0 @@ }) |
{ | ||
"name": "dictionary-en", | ||
"version": "3.1.0", | ||
"description": "English spelling dictionary in UTF-8", | ||
"version": "3.2.0", | ||
"description": "English spelling dictionary", | ||
"license": "(MIT AND BSD)", | ||
@@ -28,4 +28,5 @@ "keywords": [ | ||
"index.aff", | ||
"index.dic" | ||
"index.dic", | ||
"index.d.ts" | ||
] | ||
} |
# dictionary-en | ||
English spelling dictionary in UTF-8. | ||
English spelling dictionary. | ||
Useful with [hunspell][], [`nodehun`][nodehun], [`nspell`][nspell], | ||
Open Office, LibreOffice, Firefox and Thunderbird, or [macOS][]. | ||
## What is this? | ||
Generated by [`dictionaries`][dictionaries] from | ||
[`wordlist.aspell.net`][source]. | ||
This is a English dictionary, | ||
generated by [`wooorm/dictionaries`][dictionaries] from | ||
[`wordlist.aspell.net`][source], | ||
normalized and packaged so that it can be installed and used like other | ||
dictionaries. | ||
## When should I use this? | ||
You can use this package when integrating with tools that perform spell checking | ||
(such as [`nodehun`][nodehun], [`nspell`][nspell]) or when making such tools. | ||
## Install | ||
[npm][]: | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
@@ -22,6 +29,8 @@ ```sh | ||
```js | ||
var en = require('dictionary-en') | ||
import dictionaryEn from 'dictionary-en' | ||
en(function (err, result) { | ||
console.log(err || result) | ||
dictionaryEn(function (error, en) { | ||
if (error) throw error | ||
console.log(en) | ||
// To do: use `en` somehow | ||
}) | ||
@@ -36,16 +45,20 @@ ``` | ||
Where `dic` is a [`Buffer`][buffer] for the dictionary file at `index.dic` (in | ||
UTF-8) and `aff` is a [`Buffer`][buffer] for the affix file at `index.aff` (in | ||
UTF-8). | ||
Where `dic` and `aff` are [`Buffer`][buffer]s for `index.dic` and `index.aff` | ||
respectively. | ||
Or directly load the files, using something like: | ||
## Examples | ||
```js | ||
var path = require('path') | ||
var base = require.resolve('dictionary-en') | ||
See the [monorepo readme][dictionaries] for examples. | ||
fs.readFileSync(path.join(base, 'index.dic'), 'utf-8') | ||
fs.readFileSync(path.join(base, 'index.aff'), 'utf-8') | ||
``` | ||
## Types | ||
This package is typed with [TypeScript][]. | ||
## Contribute | ||
See the [monorepo readme][dictionaries] for how to contribute. | ||
> 👉 **Note**: dictionaries are not maintained here. | ||
> Report spelling problems upstream ([`wordlist.aspell.net`][source]). | ||
## License | ||
@@ -62,3 +75,3 @@ | ||
[macos]: https://github.com/wooorm/dictionaries#macos | ||
[macos]: https://github.com/wooorm/dictionaries#example-use-with-macos | ||
@@ -76,1 +89,3 @@ [source]: http://wordlist.aspell.net/dicts/ | ||
[home]: https://wooorm.com | ||
[typescript]: https://www.typescriptlang.org |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
574433
7
46
88