From 5f2b26a81d108061d565ba49a414182b08e473e4 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 23 Jun 2021 17:51:24 +0200 Subject: [PATCH] Use ESM for monorepo --- dictionaries/bg/index.js | 18 +- dictionaries/br/index.js | 18 +- dictionaries/ca-valencia/index.js | 18 +- dictionaries/ca/index.js | 18 +- dictionaries/cs/index.js | 18 +- dictionaries/da/index.js | 18 +- dictionaries/de-AT/index.js | 18 +- dictionaries/de-CH/index.js | 18 +- dictionaries/de/index.js | 18 +- dictionaries/el-polyton/index.js | 18 +- dictionaries/el/index.js | 18 +- dictionaries/en-AU/index.js | 18 +- dictionaries/en-CA/index.js | 18 +- dictionaries/en-GB/index.js | 18 +- dictionaries/en-ZA/index.js | 18 +- dictionaries/en/index.js | 18 +- dictionaries/eo/index.js | 18 +- dictionaries/es-AR/index.js | 18 +- dictionaries/es-BO/index.js | 18 +- dictionaries/es-CL/index.js | 18 +- dictionaries/es-CO/index.js | 18 +- dictionaries/es-CR/index.js | 18 +- dictionaries/es-CU/index.js | 18 +- dictionaries/es-DO/index.js | 18 +- dictionaries/es-EC/index.js | 18 +- dictionaries/es-GT/index.js | 18 +- dictionaries/es-HN/index.js | 18 +- dictionaries/es-MX/index.js | 18 +- dictionaries/es-NI/index.js | 18 +- dictionaries/es-PA/index.js | 18 +- dictionaries/es-PE/index.js | 18 +- dictionaries/es-PH/index.js | 18 +- dictionaries/es-PR/index.js | 18 +- dictionaries/es-PY/index.js | 18 +- dictionaries/es-SV/index.js | 18 +- dictionaries/es-US/index.js | 18 +- dictionaries/es-UY/index.js | 18 +- dictionaries/es-VE/index.js | 18 +- dictionaries/es/index.js | 18 +- dictionaries/et/index.js | 18 +- dictionaries/eu/index.js | 18 +- dictionaries/fa/index.js | 18 +- dictionaries/fo/index.js | 12 +- dictionaries/fr/index.js | 18 +- dictionaries/fur/index.js | 18 +- dictionaries/fy/index.js | 18 +- dictionaries/ga/index.js | 18 +- dictionaries/gd/index.js | 18 +- dictionaries/gl/index.js | 18 +- dictionaries/he/index.js | 18 +- dictionaries/hr/index.js | 18 +- dictionaries/hu/index.js | 18 +- dictionaries/hy/index.js | 18 +- dictionaries/hyw/index.js | 18 +- dictionaries/ia/index.js | 18 +- dictionaries/ie/index.js | 18 +- dictionaries/is/index.js | 18 +- dictionaries/it/index.js | 18 +- dictionaries/ka/index.js | 18 +- dictionaries/ko/index.js | 18 +- dictionaries/la/index.js | 18 +- dictionaries/lb/index.js | 18 +- dictionaries/lt/index.js | 18 +- dictionaries/ltg/index.js | 18 +- dictionaries/lv/index.js | 18 +- dictionaries/mk/index.js | 12 +- dictionaries/mn/index.js | 18 +- dictionaries/nb/index.js | 18 +- dictionaries/nds/index.js | 18 +- dictionaries/ne/index.js | 18 +- dictionaries/nl/index.js | 18 +- dictionaries/nn/index.js | 18 +- dictionaries/oc/index.js | 18 +- dictionaries/pl/index.js | 18 +- dictionaries/pt-PT/index.js | 18 +- dictionaries/pt/index.js | 18 +- dictionaries/ro/index.js | 18 +- dictionaries/ru/index.js | 18 +- dictionaries/rw/index.js | 18 +- dictionaries/sk/index.js | 18 +- dictionaries/sl/index.js | 18 +- dictionaries/sr-Latn/index.js | 18 +- dictionaries/sr/index.js | 18 +- dictionaries/sv-FI/index.js | 18 +- dictionaries/sv/index.js | 18 +- dictionaries/tk/index.js | 18 +- dictionaries/tlh-Latn/index.js | 18 +- dictionaries/tlh/index.js | 18 +- dictionaries/tr/index.js | 18 +- dictionaries/uk/index.js | 18 +- dictionaries/vi/index.js | 18 +- package.json | 24 +-- script/generate.js | 267 +++++++++++++++--------------- script/list-of-dictionaries.js | 38 ++--- script/template/index.js | 18 +- test.js | 111 ++++++------- 96 files changed, 1028 insertions(+), 1056 deletions(-) diff --git a/dictionaries/bg/index.js b/dictionaries/bg/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/bg/index.js +++ b/dictionaries/bg/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/br/index.js b/dictionaries/br/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/br/index.js +++ b/dictionaries/br/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ca-valencia/index.js b/dictionaries/ca-valencia/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ca-valencia/index.js +++ b/dictionaries/ca-valencia/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ca/index.js b/dictionaries/ca/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ca/index.js +++ b/dictionaries/ca/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/cs/index.js b/dictionaries/cs/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/cs/index.js +++ b/dictionaries/cs/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/da/index.js b/dictionaries/da/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/da/index.js +++ b/dictionaries/da/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/de-AT/index.js b/dictionaries/de-AT/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/de-AT/index.js +++ b/dictionaries/de-AT/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/de-CH/index.js b/dictionaries/de-CH/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/de-CH/index.js +++ b/dictionaries/de-CH/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/de/index.js b/dictionaries/de/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/de/index.js +++ b/dictionaries/de/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/el-polyton/index.js b/dictionaries/el-polyton/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/el-polyton/index.js +++ b/dictionaries/el-polyton/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/el/index.js b/dictionaries/el/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/el/index.js +++ b/dictionaries/el/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/en-AU/index.js b/dictionaries/en-AU/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/en-AU/index.js +++ b/dictionaries/en-AU/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/en-CA/index.js b/dictionaries/en-CA/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/en-CA/index.js +++ b/dictionaries/en-CA/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/en-GB/index.js b/dictionaries/en-GB/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/en-GB/index.js +++ b/dictionaries/en-GB/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/en-ZA/index.js b/dictionaries/en-ZA/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/en-ZA/index.js +++ b/dictionaries/en-ZA/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/en/index.js b/dictionaries/en/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/en/index.js +++ b/dictionaries/en/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/eo/index.js b/dictionaries/eo/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/eo/index.js +++ b/dictionaries/eo/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-AR/index.js b/dictionaries/es-AR/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-AR/index.js +++ b/dictionaries/es-AR/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-BO/index.js b/dictionaries/es-BO/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-BO/index.js +++ b/dictionaries/es-BO/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-CL/index.js b/dictionaries/es-CL/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-CL/index.js +++ b/dictionaries/es-CL/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-CO/index.js b/dictionaries/es-CO/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-CO/index.js +++ b/dictionaries/es-CO/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-CR/index.js b/dictionaries/es-CR/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-CR/index.js +++ b/dictionaries/es-CR/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-CU/index.js b/dictionaries/es-CU/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-CU/index.js +++ b/dictionaries/es-CU/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-DO/index.js b/dictionaries/es-DO/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-DO/index.js +++ b/dictionaries/es-DO/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-EC/index.js b/dictionaries/es-EC/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-EC/index.js +++ b/dictionaries/es-EC/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-GT/index.js b/dictionaries/es-GT/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-GT/index.js +++ b/dictionaries/es-GT/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-HN/index.js b/dictionaries/es-HN/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-HN/index.js +++ b/dictionaries/es-HN/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-MX/index.js b/dictionaries/es-MX/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-MX/index.js +++ b/dictionaries/es-MX/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-NI/index.js b/dictionaries/es-NI/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-NI/index.js +++ b/dictionaries/es-NI/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-PA/index.js b/dictionaries/es-PA/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-PA/index.js +++ b/dictionaries/es-PA/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-PE/index.js b/dictionaries/es-PE/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-PE/index.js +++ b/dictionaries/es-PE/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-PH/index.js b/dictionaries/es-PH/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-PH/index.js +++ b/dictionaries/es-PH/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-PR/index.js b/dictionaries/es-PR/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-PR/index.js +++ b/dictionaries/es-PR/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-PY/index.js b/dictionaries/es-PY/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-PY/index.js +++ b/dictionaries/es-PY/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-SV/index.js b/dictionaries/es-SV/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-SV/index.js +++ b/dictionaries/es-SV/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-US/index.js b/dictionaries/es-US/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-US/index.js +++ b/dictionaries/es-US/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-UY/index.js b/dictionaries/es-UY/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-UY/index.js +++ b/dictionaries/es-UY/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es-VE/index.js b/dictionaries/es-VE/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es-VE/index.js +++ b/dictionaries/es-VE/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/es/index.js b/dictionaries/es/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/es/index.js +++ b/dictionaries/es/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/et/index.js b/dictionaries/et/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/et/index.js +++ b/dictionaries/et/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/eu/index.js b/dictionaries/eu/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/eu/index.js +++ b/dictionaries/eu/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/fa/index.js b/dictionaries/fa/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/fa/index.js +++ b/dictionaries/fa/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/fo/index.js b/dictionaries/fo/index.js index 1cb217be..63e87a43 100644 --- a/dictionaries/fo/index.js +++ b/dictionaries/fo/index.js @@ -1,18 +1,18 @@ -var read = require('fs').readFile -var join = require('path').join +const read = require('fs').readFile +const join = require('path').join module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let pos = -1 + let exception = null + let result = {} one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + read(join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc diff --git a/dictionaries/fr/index.js b/dictionaries/fr/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/fr/index.js +++ b/dictionaries/fr/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/fur/index.js b/dictionaries/fur/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/fur/index.js +++ b/dictionaries/fur/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/fy/index.js b/dictionaries/fy/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/fy/index.js +++ b/dictionaries/fy/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ga/index.js b/dictionaries/ga/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ga/index.js +++ b/dictionaries/ga/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/gd/index.js b/dictionaries/gd/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/gd/index.js +++ b/dictionaries/gd/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/gl/index.js b/dictionaries/gl/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/gl/index.js +++ b/dictionaries/gl/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/he/index.js b/dictionaries/he/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/he/index.js +++ b/dictionaries/he/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/hr/index.js b/dictionaries/hr/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/hr/index.js +++ b/dictionaries/hr/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/hu/index.js b/dictionaries/hu/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/hu/index.js +++ b/dictionaries/hu/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/hy/index.js b/dictionaries/hy/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/hy/index.js +++ b/dictionaries/hy/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/hyw/index.js b/dictionaries/hyw/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/hyw/index.js +++ b/dictionaries/hyw/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ia/index.js b/dictionaries/ia/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ia/index.js +++ b/dictionaries/ia/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ie/index.js b/dictionaries/ie/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ie/index.js +++ b/dictionaries/ie/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/is/index.js b/dictionaries/is/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/is/index.js +++ b/dictionaries/is/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/it/index.js b/dictionaries/it/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/it/index.js +++ b/dictionaries/it/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ka/index.js b/dictionaries/ka/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ka/index.js +++ b/dictionaries/ka/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ko/index.js b/dictionaries/ko/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ko/index.js +++ b/dictionaries/ko/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/la/index.js b/dictionaries/la/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/la/index.js +++ b/dictionaries/la/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/lb/index.js b/dictionaries/lb/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/lb/index.js +++ b/dictionaries/lb/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/lt/index.js b/dictionaries/lt/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/lt/index.js +++ b/dictionaries/lt/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ltg/index.js b/dictionaries/ltg/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ltg/index.js +++ b/dictionaries/ltg/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/lv/index.js b/dictionaries/lv/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/lv/index.js +++ b/dictionaries/lv/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/mk/index.js b/dictionaries/mk/index.js index 1cb217be..63e87a43 100644 --- a/dictionaries/mk/index.js +++ b/dictionaries/mk/index.js @@ -1,18 +1,18 @@ -var read = require('fs').readFile -var join = require('path').join +const read = require('fs').readFile +const join = require('path').join module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let pos = -1 + let exception = null + let result = {} one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + read(join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc diff --git a/dictionaries/mn/index.js b/dictionaries/mn/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/mn/index.js +++ b/dictionaries/mn/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/nb/index.js b/dictionaries/nb/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/nb/index.js +++ b/dictionaries/nb/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/nds/index.js b/dictionaries/nds/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/nds/index.js +++ b/dictionaries/nds/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ne/index.js b/dictionaries/ne/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ne/index.js +++ b/dictionaries/ne/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/nl/index.js b/dictionaries/nl/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/nl/index.js +++ b/dictionaries/nl/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/nn/index.js b/dictionaries/nn/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/nn/index.js +++ b/dictionaries/nn/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/oc/index.js b/dictionaries/oc/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/oc/index.js +++ b/dictionaries/oc/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/pl/index.js b/dictionaries/pl/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/pl/index.js +++ b/dictionaries/pl/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/pt-PT/index.js b/dictionaries/pt-PT/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/pt-PT/index.js +++ b/dictionaries/pt-PT/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/pt/index.js b/dictionaries/pt/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/pt/index.js +++ b/dictionaries/pt/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ro/index.js b/dictionaries/ro/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ro/index.js +++ b/dictionaries/ro/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/ru/index.js b/dictionaries/ru/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/ru/index.js +++ b/dictionaries/ru/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/rw/index.js b/dictionaries/rw/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/rw/index.js +++ b/dictionaries/rw/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sk/index.js b/dictionaries/sk/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sk/index.js +++ b/dictionaries/sk/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sl/index.js b/dictionaries/sl/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sl/index.js +++ b/dictionaries/sl/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sr-Latn/index.js b/dictionaries/sr-Latn/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sr-Latn/index.js +++ b/dictionaries/sr-Latn/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sr/index.js b/dictionaries/sr/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sr/index.js +++ b/dictionaries/sr/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sv-FI/index.js b/dictionaries/sv-FI/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sv-FI/index.js +++ b/dictionaries/sv-FI/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/sv/index.js b/dictionaries/sv/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/sv/index.js +++ b/dictionaries/sv/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/tk/index.js b/dictionaries/tk/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/tk/index.js +++ b/dictionaries/tk/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/tlh-Latn/index.js b/dictionaries/tlh-Latn/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/tlh-Latn/index.js +++ b/dictionaries/tlh-Latn/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/tlh/index.js b/dictionaries/tlh/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/tlh/index.js +++ b/dictionaries/tlh/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/tr/index.js b/dictionaries/tr/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/tr/index.js +++ b/dictionaries/tr/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/uk/index.js b/dictionaries/uk/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/uk/index.js +++ b/dictionaries/uk/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/dictionaries/vi/index.js b/dictionaries/vi/index.js index 1cb217be..5fac8e90 100644 --- a/dictionaries/vi/index.js +++ b/dictionaries/vi/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/package.json b/package.json index 69f98456..a389b586 100644 --- a/package.json +++ b/package.json @@ -21,25 +21,22 @@ "Titus Wormer (https://wooorm.com)", "Thomas Beverley " ], + "type": "module", "dependencies": {}, "devDependencies": { - "bail": "^1.0.0", - "bcp-47": "^1.0.0", - "bcp-47-normalize": "^1.0.0", - "is-hidden": "^1.0.0", + "bcp-47": "^2.0.0", + "bcp-47-normalize": "^2.0.0", + "is-hidden": "^2.0.0", "language-tags": "^1.0.0", - "mdast-zone": "^4.0.0", - "negate": "^1.0.0", - "not": "^0.1.0", + "mdast-zone": "^5.0.0", "prettier": "^2.0.0", "remark-cli": "^9.0.0", "remark-preset-wooorm": "^8.0.0", "tape": "^5.0.0", - "to-vfile": "^6.0.0", - "unist-builder": "^2.0.0", + "to-vfile": "^7.0.0", + "unist-builder": "^3.0.0", "utf-8-validate": "^5.0.0", - "xo": "^0.37.0", - "xtend": "^4.0.0" + "xo": "^0.39.0" }, "scripts": { "generate": "sh script/crawl.sh && node script/generate", @@ -57,11 +54,8 @@ }, "xo": { "prettier": true, - "esnext": false, "rules": { - "unicorn/prefer-optional-catch-binding": "off", - "unicorn/no-array-callback-reference": "off", - "unicorn/no-fn-reference-in-iterator": "off" + "unicorn/prefer-switch": "off" } }, "remarkConfig": { diff --git a/script/generate.js b/script/generate.js index fed7c8ed..7a95e24b 100644 --- a/script/generate.js +++ b/script/generate.js @@ -1,29 +1,26 @@ -'use strict' - -var fs = require('fs') -var path = require('path') -var xtend = require('xtend') -var hidden = require('is-hidden') -var negate = require('negate') -var bcp47 = require('bcp-47') -var tags = require('language-tags') -var pkg = require('../package.json') - -var dir = fs.readdirSync -var exists = fs.existsSync -var read = fs.readFileSync -var write = fs.writeFileSync -var join = path.join - -var docs = read(template('readme.md'), 'utf-8') -var index = read(template('index.js'), 'utf-8') - -var types = { +import fs from 'fs' +import path from 'path' +import {isHidden} from 'is-hidden' +import {parse} from 'bcp-47' +import tags from 'language-tags' + +const own = {}.hasOwnProperty + +const pkg = JSON.parse(String(fs.readFileSync('package.json'))) + +const docs = String( + fs.readFileSync(path.join('script', 'template', 'readme.md')) +) +const main = String( + fs.readFileSync(path.join('script', 'template', 'index.js')) +) + +const types = { variants: 'variant', extensions: 'extlang' } -var remove = { +const remove = { ca: ['or Valencian', 'Valencian'], 'ca-valencia': ['or Valencian'], el: ['(1453-)'], @@ -32,7 +29,7 @@ var remove = { ne: ['(macrolanguage)'] } -var replace = { +const replace = { el: {'Modern Greek (1453-)': 'Modern Greek'}, 'el-polyton': {'Modern Greek (1453-)': 'Modern Greek'}, ia: { @@ -44,122 +41,128 @@ var replace = { oc: {'(post': 'post', '1500)': '1500'} } -dir('dictionaries') - .filter(negate(hidden)) +const dictionaries = fs + .readdirSync('dictionaries') + .filter((d) => !isHidden(d)) .sort() - .forEach(function (code) { - var base = dict(code) - var tag = bcp47.parse(code) - var parts = [] - var pack = {} - var keywords = ['spelling', 'myspell', 'hunspell', 'dictionary'] - var source - var description - - try { - source = read(join(base, '.source'), 'utf-8').trim() - } catch (_) { - console.log('Cannot find dictionary for `%s`', code) - return +let index = -1 + +while (++index < dictionaries.length) { + const code = dictionaries[index] + const base = path.join('dictionaries', code) + const tag = parse(code) + let parts = [] + let pack = {} + let keywords = ['spelling', 'myspell', 'hunspell', 'dictionary'] + let source + let description + + try { + source = fs.readFileSync(path.join(base, '.source'), 'utf-8').trim() + } catch { + console.log('Cannot find dictionary for `%s`', code) + continue + } + + try { + pack = JSON.parse(fs.readFileSync(path.join(base, 'package.json'))) + } catch {} + + keywords = keywords.concat(code.toLowerCase().split('-')) + let key + + for (key in tag) { + if (!own.call(tag, key)) continue + + const label = types[key] || key + const value = Array.isArray(tag[key]) ? tag[key] : [tag[key]] + let offset = -1 + + while (++offset < value.length) { + const subvalue = value[offset] + if (!subvalue) continue + const subtag = subvalue ? tags.type(subvalue, label) : null + let data = subtag ? subtag.data.record.Description : null + + // Fix bug in `language-tags`, where the description of a tag when + // indented is seen as an array, instead of continued text. + if (subtag.data.subtag === 'ia') { + data = [data.join(' ')] + } + + keywords = keywords.concat(data.join(' ').toLowerCase().split(' ')) + + if (label === 'language') { + parts = [data[0]].concat( + data.slice(1).map((x) => 'or ' + x), + parts + ) + } else if (label === 'script') { + parts = parts.concat(data.join(' ') + ' script') + } else { + parts = parts.concat(data) + } } + } - try { - pack = JSON.parse(read(join(base, 'package.json'))) - } catch (_) {} - - keywords = keywords.concat(code.toLowerCase().split('-')) - - Object.keys(tag).forEach(function (key) { - var label = types[key] || key - var value = tag[key] - - value = value && typeof value === 'object' ? value : [value] - - value.filter(Boolean).forEach(function (subvalue) { - var subtag = subvalue ? tags.type(subvalue, label) : null - var data = subtag ? subtag.data.record.Description : null - - // Fix bug in `language-tags`, where the description of a tag when - // indented is seen as an array, instead of continued text. - if (subtag.data.subtag === 'ia') { - data = [data.join(' ')] - } - - keywords = keywords.concat(data.join(' ').toLowerCase().split(' ')) - - if (label === 'language') { - parts = [data[0]].concat( - data.slice(1).map(function (x) { - return 'or ' + x - }), - parts - ) - } else if (label === 'script') { - parts = parts.concat(data.join(' ') + ' script') - } else { - parts = parts.concat(data) - } - }) - }) + keywords = keywords + .filter(Boolean) + .filter((key, index, parent) => !parent.includes(key, index + 1)) + .filter((d) => (remove[code] ? !remove[code].includes(d) : true)) + .map((d) => (replace[code] ? replace[code][d] : null) || d) - keywords = keywords - .filter(Boolean) - .filter(unique) - .filter(ignore) - .map(change) - parts = parts.filter(Boolean).filter(unique).filter(ignore).map(change) + parts = parts + .filter(Boolean) + .filter((key, index, parent) => !parent.includes(key, index + 1)) + .filter((d) => (remove[code] ? !remove[code].includes(d) : true)) + .map((d) => (replace[code] ? replace[code][d] : null) || d) - description = parts[0] + description = parts[0] - if (parts.length > 1) { - description += ' (' + parts.slice(1).join('; ') + ')' - } + if (parts.length > 1) { + description += ' (' + parts.slice(1).join('; ') + ')' + } - pack = { - name: 'dictionary-' + code.toLowerCase(), - version: pack.version || '0.0.0', - description: description + ' spelling dictionary in UTF-8', - license: read(join(base, '.spdx'), 'utf-8').trim(), - keywords: keywords, - repository: pkg.repository + '/tree/main/dictionaries/' + code, - bugs: pkg.bugs, - funding: pkg.funding, - author: pkg.author, - contributors: pkg.contributors, - files: ['index.js', 'index.aff', 'index.dic'] - } + pack = { + name: 'dictionary-' + code.toLowerCase(), + version: pack.version || '0.0.0', + description: description + ' spelling dictionary in UTF-8', + license: fs.readFileSync(path.join(base, '.spdx'), 'utf-8').trim(), + keywords, + repository: pkg.repository + '/tree/main/dictionaries/' + code, + bugs: pkg.bugs, + funding: pkg.funding, + author: pkg.author, + contributors: pkg.contributors, + files: ['index.js', 'index.aff', 'index.dic'] + } - write( - join(base, 'readme.md'), - process( - docs, - xtend(pack, { - source: source, - variable: camelcase(code.toLowerCase()), - code: code, - hasLicense: exists(join(base, 'license')) - }) - ) + fs.writeFileSync( + path.join(base, 'readme.md'), + process( + docs, + Object.assign({}, pack, { + source, + variable: camelcase(code.toLowerCase()), + code, + hasLicense: fs.existsSync(path.join(base, 'license')) + }) ) + ) - write(join(base, 'index.js'), index) - - write(join(base, 'package.json'), JSON.stringify(pack, 0, 2) + '\n') - - function ignore(value) { - return remove[code] ? !remove[code].includes(value) : true - } + fs.writeFileSync(path.join(base, 'index.js'), main) - function change(value) { - return (replace[code] ? replace[code][value] : null) || value - } - }) + fs.writeFileSync( + path.join(base, 'package.json'), + JSON.stringify(pack, null, 2) + '\n' + ) +} function process(file, config) { - var license = config.license - var source = config.source - var uri = new URL(source) - var sourceName = uri.host + let license = config.license + const source = config.source + const uri = new URL(source) + let sourceName = uri.host // Clean name. if (sourceName === 'github.com') { @@ -193,18 +196,6 @@ function process(file, config) { .replace(/{{LICENSE}}/g, license) } -function template(fileName) { - return join(__dirname, 'template', fileName) -} - -function dict(code) { - return join('dictionaries', code) -} - -function unique(key, index, parent) { - return !parent.includes(key, index + 1) -} - function camelcase(value) { return value.replace(/-[a-z]/gi, replace) function replace(d) { diff --git a/script/list-of-dictionaries.js b/script/list-of-dictionaries.js index 52da36a9..b7e68056 100644 --- a/script/list-of-dictionaries.js +++ b/script/list-of-dictionaries.js @@ -1,19 +1,14 @@ -'use strict' +import fs from 'fs' +import path from 'path' +import {u} from 'unist-builder' +import {zone} from 'mdast-zone' +import {isHidden} from 'is-hidden' -module.exports = listOfDictionaries +const join = path.join -var fs = require('fs') -var path = require('path') -var u = require('unist-builder') -var zone = require('mdast-zone') -var hidden = require('is-hidden') -var negate = require('negate') +const root = join(process.cwd(), 'dictionaries') -var join = path.join - -var root = join(process.cwd(), 'dictionaries') - -function listOfDictionaries() { +export default function listOfDictionaries() { return transformer } @@ -22,7 +17,10 @@ function transformer(tree) { } function replace(start, nodes, end) { - var rows = fs.readdirSync(root).filter(negate(hidden)).map(row) + const rows = fs + .readdirSync(root) + .filter((d) => !isHidden(d)) + .map((d) => row(d)) return [ start, @@ -44,18 +42,18 @@ function replace(start, nodes, end) { } function row(name) { - var url = 'dictionaries/' + name - var base = join(root, name) - var pack = JSON.parse(fs.readFileSync(join(base, 'package.json'))) - var license = [u('text', pack.license)] - var description = pack.description.replace(/\sspelling.+$/, '') + const url = 'dictionaries/' + name + const base = join(root, name) + const pack = JSON.parse(fs.readFileSync(join(base, 'package.json'))) + let license = [u('text', pack.license)] + const description = pack.description.replace(/\sspelling.+$/, '') if (fs.existsSync(join(base, 'license'))) { license = [u('link', {url: url + '/license'}, license)] } return u('tableRow', [ - u('tableCell', [u('link', {url: url}, [u('inlineCode', pack.name)])]), + u('tableCell', [u('link', {url}, [u('inlineCode', pack.name)])]), u('tableCell', [u('text', description)]), u('tableCell', license) ]) diff --git a/script/template/index.js b/script/template/index.js index 1cb217be..5fac8e90 100644 --- a/script/template/index.js +++ b/script/template/index.js @@ -1,26 +1,26 @@ -var read = require('fs').readFile -var join = require('path').join +const fs = require('fs') +const path = require('path') module.exports = load function load(callback) { - var pos = -1 - var exception = null - var result = {} + let result = {} + let pos = -1 + let exception one('aff') one('dic') function one(name) { - read(join(__dirname, 'index.' + name), function (error, doc) { + fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => { pos++ exception = exception || error result[name] = doc if (pos) { - callback(exception, exception ? null : result) - exception = null - result = null + callback(exception, exception ? undefined : result) + exception = undefined + result = undefined } }) } diff --git a/test.js b/test.js index df45780d..bc7ae4a3 100644 --- a/test.js +++ b/test.js @@ -1,19 +1,17 @@ -'use strict' - -var fs = require('fs') -var path = require('path') -var assert = require('assert') -var test = require('tape') -var vfile = require('to-vfile') -var bail = require('bail') -var not = require('not') -var hidden = require('is-hidden') -var isUtf8 = require('utf-8-validate') -var normalize = require('bcp-47-normalize') - -var root = 'dictionaries' - -var checks = { +import fs from 'fs' +import path from 'path' +import assert from 'assert' +import test from 'tape' +import {toVFile} from 'to-vfile' +import {isHidden} from 'is-hidden' +import isUtf8 from 'utf-8-validate' +import {bcp47Normalize} from 'bcp-47-normalize' + +const own = {}.hasOwnProperty + +const root = 'dictionaries' + +const checks = { 'Should have a canonical BCP-47 tag': bcp47, 'All required files should exist': requiredFiles, 'All files should be in UTF-8': utf8 @@ -22,7 +20,7 @@ var checks = { function bcp47(name) { assert.strictEqual( name, - normalize(name, {warning: warn}), + bcp47Normalize(name, {warning: warn}), name + ' should be a canonical, normal BCP-47 tag' ) @@ -32,68 +30,59 @@ function bcp47(name) { } function utf8(name) { - var dirname = path.join(root, name) - - fs.readdirSync(dirname).filter(not(hidden)).forEach(check) - - function check(filename) { - var file = vfile.readSync(path.join(dirname, filename)) - assert.ok(isUtf8(file.contents), file.basename + ' should be utf8') + const dirname = path.join(root, name) + const files = fs.readdirSync(dirname) + let index = -1 + + while (++index < files.length) { + const d = files[index] + if (isHidden(d)) continue + const file = toVFile.readSync(path.join(dirname, d)) + assert.ok(isUtf8(file.value), file.basename + ' should be utf8') } } function requiredFiles(name) { - var dirname = path.join(root, name) - var files = fs.readdirSync(dirname).filter(not(hidden)) - var paths = [ + const dirname = path.join(root, name) + const files = fs.readdirSync(dirname).filter((d) => !isHidden(d)) + const paths = [ 'index.dic', 'index.aff', 'readme.md', 'index.js', 'package.json' ] + let index = -1 - paths.forEach(check) - - function check(basename) { - assert.notStrictEqual( - files.indexOf(basename), - -1, - 'should have `' + basename + '`' - ) + while (++index < paths.length) { + const d = paths[index] + assert.notStrictEqual(files.indexOf(d), -1, 'should have `' + d + '`') } } -test('dictionaries', function (t) { - fs.readdir(root, ondir) - - function ondir(error, paths) { - bail(error) +test('dictionaries', (t) => { + const files = fs.readdirSync(root) + let index = -1 - paths = paths.filter(not(hidden)) + while (++index < files.length) { + const d = files[index] - t.plan(paths.length) + if (isHidden(d)) continue - paths.forEach(check, t) - } -}) + t.test(d, (st) => { + let key -function check(basename) { - this.test(basename, all) + for (key in checks) { + if (!own.call(checks, key)) continue - function all(st) { - var descriptions = Object.keys(checks) - - st.plan(descriptions.length) - - descriptions.forEach(one) - - function one(description) { - st.doesNotThrow(check, description) - - function check() { - checks[description](basename) + st.doesNotThrow(() => { + checks[key](d) + }, key) } - } + + st.end() + }) } -} + + t.end() +})