d11 theme
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
2.3 KiB

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.traceWords = void 0;
const Settings_1 = require("./Settings");
const SpellingDictionary_1 = require("./SpellingDictionary");
const util = __importStar(require("./util/util"));
const gensequence_1 = require("gensequence");
async function traceWords(words, settings) {
const r = await Promise.all(gensequence_1.genSequence(words)
// Combine the words with the configs
.map((word) => ({ word, config: settings }))
// Load the dictionaries
.map(async ({ word, config }) => {
const settings = Settings_1.finalizeSettings(config);
const dictionaries = (settings.dictionaries || [])
.concat((settings.dictionaryDefinitions || []).map((d) => d.name))
.filter(util.uniqueFn);
const dictSettings = { ...settings, dictionaries };
const dicts = await SpellingDictionary_1.getDictionary(dictSettings);
return { word, config, dicts };
})
.toArray());
// Search each dictionary for the word
const s = gensequence_1.genSequence(r)
.concatMap((p) => {
const { word, config, dicts } = p;
return dicts.dictionaries.map((dict) => ({
word,
found: dict.has(word),
dictName: dict.name,
dictSource: dict.source,
configSource: config.name || '',
}));
})
.toArray();
return s;
}
exports.traceWords = traceWords;
//# sourceMappingURL=trace.js.map