dictionary-en-za
Advanced tools
Comparing version 1.0.2 to 1.2.0
82
index.js
@@ -1,71 +0,29 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module dictionary-en-za | ||
* @fileoverview English (South Africa) spelling dictionary in UTF-8. | ||
*/ | ||
/* | ||
* Dependencies. | ||
*/ | ||
/* Dependencies. */ | ||
var read = require('fs').readFile; | ||
var join = require('path').join; | ||
/** | ||
* A dictionary. | ||
* | ||
* @typedef {Object} Dictionary | ||
* @property {Buffer} dic - Dictionary buffer in UTF-8. | ||
* @property {Buffer} add - Affix buffer in UTF-8. | ||
*/ | ||
/* Expose. */ | ||
module.exports = load; | ||
/** | ||
* Callback invoked with a dictionary. | ||
* | ||
* @callback callback | ||
* @param {Error?} err - Error while reading the dictionary | ||
* files. | ||
* @param {Dictionary?} dictionary - A dictionary. | ||
*/ | ||
/** | ||
* Load the dictionaries. | ||
* | ||
* @param {callback} callback | ||
*/ | ||
/* Load the dictionary-en-za dictionaries. */ | ||
function load(callback) { | ||
var pos = -1; | ||
var exception = null; | ||
var result = {}; | ||
var pos = -1; | ||
var exception = null; | ||
var result = {}; | ||
/** | ||
* Load a file. | ||
* | ||
* @param {string} name - Extension and type of file | ||
* to load. | ||
*/ | ||
function one(name) { | ||
read(join(__dirname, 'index.' + name), function (err, doc) { | ||
pos++; | ||
one('aff'); | ||
one('dic'); | ||
exception = exception || err; | ||
result[name] = doc; | ||
function one(name) { | ||
read(join(__dirname, 'index.' + name), function (err, doc) { | ||
pos++; | ||
exception = exception || err; | ||
result[name] = doc; | ||
if (pos) { | ||
callback(exception, !exception && result) | ||
result = exception = null; | ||
} | ||
}); | ||
} | ||
one('aff'); | ||
one('dic'); | ||
if (pos) { | ||
callback(exception, exception ? null : result); | ||
result = exception = null; | ||
} | ||
}); | ||
} | ||
} | ||
/* | ||
* Expose. | ||
*/ | ||
module.exports = load; |
{ | ||
"name": "dictionary-en-za", | ||
"version": "1.0.2", | ||
"version": "1.2.0", | ||
"description": "English (South Africa) spelling dictionary in UTF-8", | ||
@@ -15,4 +15,11 @@ "license": "LGPL-2.1", | ||
], | ||
"repository": "wooorm/dictionary", | ||
"author": "Titus Wormer <tituswormer@gmail.com>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wooorm/dictionaries" | ||
}, | ||
"bugs": "https://github.com/wooorm/dictionaries/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
], | ||
"main": "index.js", | ||
@@ -19,0 +26,0 @@ "files": [ |
@@ -53,3 +53,3 @@ # dictionary-en-za | ||
Dictionary and affix file: [LGPL-2.1][license]. Rest: MIT © | ||
Dictionary and affix file: [LGPL-2.1](https://github.com/wooorm/dictionaries/blob/master/dictionaries/en_ZA/LICENSE). Rest: MIT © | ||
[Titus Wormer][home]. | ||
@@ -67,6 +67,4 @@ | ||
[license]: https://github.com/wooorm/dictionaries/blob/master/dictionaries/en_ZA/LICENSE | ||
[dictionaries]: https://github.com/wooorm/dictionaries | ||
[home]: https://wooorm.com |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
1
667948
24
69