cspell-dictionary 6.14.2 → 6.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SpellingDictionary/IgnoreWordsDictionary.js +1 -1
- package/dist/SpellingDictionary/SpellingDictionary.d.ts +2 -2
- package/dist/SpellingDictionary/SpellingDictionaryMethods.d.ts +2 -2
- package/dist/SpellingDictionary/Typos/index.d.ts +4 -0
- package/dist/SpellingDictionary/Typos/index.js +11 -0
- package/dist/SpellingDictionary/Typos/typos.d.ts +18 -0
- package/dist/SpellingDictionary/Typos/typos.js +3 -0
- package/dist/SpellingDictionary/Typos/typosParser.d.ts +17 -0
- package/dist/SpellingDictionary/Typos/typosParser.js +123 -0
- package/dist/SpellingDictionary/Typos/util.d.ts +12 -0
- package/dist/SpellingDictionary/Typos/util.js +57 -0
- package/dist/SpellingDictionary/TyposDictionary.d.ts +12 -0
- package/dist/SpellingDictionary/TyposDictionary.js +104 -0
- package/dist/util/repMap.d.ts +1 -1
- package/dist/util/types.d.ts +1 -1
- package/package.json +6 -6
|
@@ -35,7 +35,7 @@ class IgnoreWordsDictionary {
|
|
|
35
35
|
this.source = source;
|
|
36
36
|
this.containsNoSuggestWords = true;
|
|
37
37
|
this.options = {};
|
|
38
|
-
this.type = '
|
|
38
|
+
this.type = 'ignore';
|
|
39
39
|
this.isDictionaryCaseSensitive = true;
|
|
40
40
|
this.dict = new Set(words);
|
|
41
41
|
this.dictNonStrict = new Set((0, sync_1.pipe)(this.dict, (0, sync_1.opFilter)((w) => w.startsWith('~')), (0, sync_1.opMap)((w) => w.slice(1))));
|
|
@@ -35,7 +35,7 @@ export interface SuggestOptions {
|
|
|
35
35
|
*/
|
|
36
36
|
timeout?: number;
|
|
37
37
|
}
|
|
38
|
-
export
|
|
38
|
+
export type FindOptions = SearchOptions;
|
|
39
39
|
export interface FindResult {
|
|
40
40
|
/** the text found, otherwise `false` */
|
|
41
41
|
found: string | false;
|
|
@@ -44,7 +44,7 @@ export interface FindResult {
|
|
|
44
44
|
/** `true` if it is a no-suggest word. */
|
|
45
45
|
noSuggest: boolean;
|
|
46
46
|
}
|
|
47
|
-
export
|
|
47
|
+
export type HasOptions = SearchOptions;
|
|
48
48
|
export interface SpellingDictionaryOptions {
|
|
49
49
|
repMap?: ReplaceMap;
|
|
50
50
|
/**
|
|
@@ -2,8 +2,8 @@ import { DictionaryInformation } from '@cspell/cspell-types';
|
|
|
2
2
|
import { CompoundWordsMethod, SuggestionResult, WeightMap } from 'cspell-trie-lib';
|
|
3
3
|
import { HasOptions, SearchOptions, SpellingDictionary, SuggestOptions } from './SpellingDictionary';
|
|
4
4
|
export { impersonateCollector, suggestionCollector } from 'cspell-trie-lib';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type FilterSuggestionsPredicate = (word: SuggestionResult) => boolean;
|
|
6
|
+
export type SuggestArgs = Parameters<SpellingDictionary['suggest']> | Parameters<(word: string, numSuggestions?: number, compoundMethod?: CompoundWordsMethod, numChanges?: number, ignoreCase?: boolean) => SuggestionResult[]>;
|
|
7
7
|
export declare const defaultNumSuggestions = 10;
|
|
8
8
|
declare function wordSearchFormsArray(word: string, isDictionaryCaseSensitive: boolean, ignoreCase: boolean): string[];
|
|
9
9
|
export declare function wordSearchForms(word: string, isDictionaryCaseSensitive: boolean, ignoreCase: boolean): Set<string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractAllSuggestions = exports.createTyposDef = exports.processEntriesToTyposDef = exports.parseTyposLine = exports.parseTyposFile = void 0;
|
|
4
|
+
var typosParser_1 = require("./typosParser");
|
|
5
|
+
Object.defineProperty(exports, "parseTyposFile", { enumerable: true, get: function () { return typosParser_1.parseTyposFile; } });
|
|
6
|
+
Object.defineProperty(exports, "parseTyposLine", { enumerable: true, get: function () { return typosParser_1.parseTyposLine; } });
|
|
7
|
+
Object.defineProperty(exports, "processEntriesToTyposDef", { enumerable: true, get: function () { return typosParser_1.processEntriesToTyposDef; } });
|
|
8
|
+
var util_1 = require("./util");
|
|
9
|
+
Object.defineProperty(exports, "createTyposDef", { enumerable: true, get: function () { return util_1.createTyposDef; } });
|
|
10
|
+
Object.defineProperty(exports, "extractAllSuggestions", { enumerable: true, get: function () { return util_1.extractAllSuggestions; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type NoSuggestion = null | undefined;
|
|
2
|
+
type SingleSuggestion = string;
|
|
3
|
+
type MultipleSuggestions = string[];
|
|
4
|
+
export type TyposDefValue = MultipleSuggestions | SingleSuggestion | NoSuggestion;
|
|
5
|
+
export type TyposDefKey = string;
|
|
6
|
+
/**
|
|
7
|
+
* Typos Definition
|
|
8
|
+
* key - the incorrect word
|
|
9
|
+
* value - the suggestions.
|
|
10
|
+
*/
|
|
11
|
+
export type TyposDef = Record<TyposDefKey, TyposDefValue>;
|
|
12
|
+
type TypoNoSuggestions = string;
|
|
13
|
+
type TypoWithSuggestionsArray = [forbidWord: string, ...suggestions: string[]];
|
|
14
|
+
type TypoWithSuggestionsObj = TyposDef;
|
|
15
|
+
type TypoWithSuggestions = TypoWithSuggestionsArray | TypoWithSuggestionsObj;
|
|
16
|
+
export type TypoEntry = TypoNoSuggestions | TypoWithSuggestions;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=typos.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TypoEntry, TyposDef } from './typos';
|
|
2
|
+
export declare function createTyposDefFromEntries(entries: Iterable<TypoEntry>): TyposDef;
|
|
3
|
+
export declare function sanitizeIntoTypoDef(dirtyDef: TyposDef | Record<string, unknown> | unknown): TyposDef | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Used to process entries found in a `cspell.json` file.
|
|
6
|
+
* @param entries - entries to process
|
|
7
|
+
* @returns a TyposDef
|
|
8
|
+
*/
|
|
9
|
+
export declare function processEntriesToTyposDef(entries: TyposDef | readonly TypoEntry[] | Record<string, unknown>): TyposDef;
|
|
10
|
+
/**
|
|
11
|
+
* Tries to parse an entry.
|
|
12
|
+
* @param line - any valid TypoEntry.
|
|
13
|
+
* @returns a valid TypoEntry
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseTyposLine(line: TypoEntry): TypoEntry | undefined;
|
|
16
|
+
export declare function parseTyposFile(content: string): TyposDef;
|
|
17
|
+
//# sourceMappingURL=typosParser.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseTyposFile = exports.parseTyposLine = exports.processEntriesToTyposDef = exports.sanitizeIntoTypoDef = exports.createTyposDefFromEntries = void 0;
|
|
7
|
+
const assert_1 = __importDefault(require("assert"));
|
|
8
|
+
const util_1 = require("./util");
|
|
9
|
+
function assertString(v) {
|
|
10
|
+
(0, assert_1.default)(typeof v === 'string', 'A string was expected.');
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const suggestionsSeparator = /[,]/;
|
|
14
|
+
const typoSuggestionsSeparator = /:|->/;
|
|
15
|
+
const typoEntrySeparator = /[\n;]/;
|
|
16
|
+
const inlineComment = /#.*/gm;
|
|
17
|
+
function createTyposDefFromEntries(entries) {
|
|
18
|
+
const def = Object.create(null);
|
|
19
|
+
for (const entry of entries) {
|
|
20
|
+
(0, util_1.appendToDef)(def, entry);
|
|
21
|
+
}
|
|
22
|
+
return def;
|
|
23
|
+
}
|
|
24
|
+
exports.createTyposDefFromEntries = createTyposDefFromEntries;
|
|
25
|
+
function normalize(s) {
|
|
26
|
+
return s.normalize();
|
|
27
|
+
}
|
|
28
|
+
function trimAndFilter(lines) {
|
|
29
|
+
return lines
|
|
30
|
+
.map((s) => s.trim())
|
|
31
|
+
.filter((s) => !!s)
|
|
32
|
+
.map(normalize);
|
|
33
|
+
}
|
|
34
|
+
function cleanSugs(rawSugs) {
|
|
35
|
+
const sugs = trimAndFilter(rawSugs);
|
|
36
|
+
return sugs.length === 1 ? sugs[0] : sugs.length ? sugs : null;
|
|
37
|
+
}
|
|
38
|
+
function splitSuggestionsValue(value) {
|
|
39
|
+
return cleanSugs(value.split(suggestionsSeparator));
|
|
40
|
+
}
|
|
41
|
+
function sanitizeIntoTypoDef(dirtyDef) {
|
|
42
|
+
if (!dirtyDef || typeof dirtyDef !== 'object')
|
|
43
|
+
return undefined;
|
|
44
|
+
const def = (0, util_1.createTyposDef)();
|
|
45
|
+
for (const [rawKey, value] of Object.entries(dirtyDef)) {
|
|
46
|
+
const key = normalize(rawKey.trim());
|
|
47
|
+
if (!key)
|
|
48
|
+
continue;
|
|
49
|
+
if (typeof value === 'string') {
|
|
50
|
+
def[key] = splitSuggestionsValue(value);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
const sugs = cleanSugs(value.filter(assertString));
|
|
55
|
+
def[key] = sugs;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
(0, assert_1.default)(value === null || value === undefined, 'Unexpected suggestion type.');
|
|
59
|
+
def[key] = null;
|
|
60
|
+
}
|
|
61
|
+
return def;
|
|
62
|
+
}
|
|
63
|
+
exports.sanitizeIntoTypoDef = sanitizeIntoTypoDef;
|
|
64
|
+
/**
|
|
65
|
+
* Used to process entries found in a `cspell.json` file.
|
|
66
|
+
* @param entries - entries to process
|
|
67
|
+
* @returns a TyposDef
|
|
68
|
+
*/
|
|
69
|
+
function processEntriesToTyposDef(entries) {
|
|
70
|
+
const def = Array.isArray(entries) ? reduceToTyposDef(entries) : entries;
|
|
71
|
+
const result = sanitizeIntoTypoDef(def);
|
|
72
|
+
(0, assert_1.default)(result);
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
exports.processEntriesToTyposDef = processEntriesToTyposDef;
|
|
76
|
+
function reduceToTyposDef(entries) {
|
|
77
|
+
const def = (0, util_1.createTyposDef)();
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
(0, util_1.appendToDef)(def, parseTyposLine(entry));
|
|
80
|
+
}
|
|
81
|
+
return def;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Tries to parse an entry.
|
|
85
|
+
* @param line - any valid TypoEntry.
|
|
86
|
+
* @returns a valid TypoEntry
|
|
87
|
+
*/
|
|
88
|
+
function parseTyposLine(line) {
|
|
89
|
+
if (!line)
|
|
90
|
+
return undefined;
|
|
91
|
+
if (typeof line === 'string') {
|
|
92
|
+
const def = (0, util_1.createTyposDef)();
|
|
93
|
+
for (const subEntry of splitIntoLines(line)) {
|
|
94
|
+
const [left, right] = splitEntry(subEntry);
|
|
95
|
+
const typo = left.trim();
|
|
96
|
+
if (!right)
|
|
97
|
+
return typo;
|
|
98
|
+
const sugs = splitSuggestionsValue(right);
|
|
99
|
+
def[typo] = sugs;
|
|
100
|
+
}
|
|
101
|
+
return def;
|
|
102
|
+
}
|
|
103
|
+
if (Array.isArray(line)) {
|
|
104
|
+
const [key, ...sugs] = line.filter(assertString).map((s) => s.trim());
|
|
105
|
+
if (!key)
|
|
106
|
+
return undefined;
|
|
107
|
+
return [key, ...sugs];
|
|
108
|
+
}
|
|
109
|
+
return sanitizeIntoTypoDef(line);
|
|
110
|
+
}
|
|
111
|
+
exports.parseTyposLine = parseTyposLine;
|
|
112
|
+
function splitIntoLines(content) {
|
|
113
|
+
return trimAndFilter(normalize(content).split(typoEntrySeparator));
|
|
114
|
+
}
|
|
115
|
+
function splitEntry(line) {
|
|
116
|
+
return line.split(typoSuggestionsSeparator, 2);
|
|
117
|
+
}
|
|
118
|
+
function parseTyposFile(content) {
|
|
119
|
+
const lines = splitIntoLines(content.replace(inlineComment, ''));
|
|
120
|
+
return reduceToTyposDef(lines);
|
|
121
|
+
}
|
|
122
|
+
exports.parseTyposFile = parseTyposFile;
|
|
123
|
+
//# sourceMappingURL=typosParser.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypoEntry, TyposDef, TyposDefKey, TyposDefValue } from './typos';
|
|
2
|
+
/**
|
|
3
|
+
* Append an entry to a TyposDef.
|
|
4
|
+
* @param def - modified in place
|
|
5
|
+
* @param entry- entry to add.
|
|
6
|
+
* @returns def
|
|
7
|
+
*/
|
|
8
|
+
export declare function appendToDef(def: TyposDef, entry: TypoEntry | undefined): TyposDef;
|
|
9
|
+
export declare function createTyposDef(entries?: Iterable<[TyposDefKey, TyposDefValue]>): TyposDef;
|
|
10
|
+
export declare function extractAllSuggestions(typosDef: TyposDef): Set<string>;
|
|
11
|
+
export declare function extractIgnoreValues(typosDef: TyposDef, ignorePrefix: string): Set<string>;
|
|
12
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractIgnoreValues = exports.extractAllSuggestions = exports.createTyposDef = exports.appendToDef = void 0;
|
|
4
|
+
const sync_1 = require("@cspell/cspell-pipe/sync");
|
|
5
|
+
/**
|
|
6
|
+
* Append an entry to a TyposDef.
|
|
7
|
+
* @param def - modified in place
|
|
8
|
+
* @param entry- entry to add.
|
|
9
|
+
* @returns def
|
|
10
|
+
*/
|
|
11
|
+
function appendToDef(def, entry) {
|
|
12
|
+
if (!entry)
|
|
13
|
+
return def;
|
|
14
|
+
if (typeof entry === 'string') {
|
|
15
|
+
def[entry] = null;
|
|
16
|
+
return def;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(entry)) {
|
|
19
|
+
const [key, ...sugs] = entry.map((s) => s.trim());
|
|
20
|
+
if (!key)
|
|
21
|
+
return def;
|
|
22
|
+
const s = sugs.map((s) => s.trim()).filter((s) => !!s);
|
|
23
|
+
def[key] = !s.length ? null : s.length === 1 ? s[0] : s;
|
|
24
|
+
return def;
|
|
25
|
+
}
|
|
26
|
+
Object.assign(def, entry);
|
|
27
|
+
return def;
|
|
28
|
+
}
|
|
29
|
+
exports.appendToDef = appendToDef;
|
|
30
|
+
function createTyposDef(entries) {
|
|
31
|
+
const def = Object.create(null);
|
|
32
|
+
if (!entries)
|
|
33
|
+
return def;
|
|
34
|
+
for (const [key, value] of entries) {
|
|
35
|
+
def[key] = value;
|
|
36
|
+
}
|
|
37
|
+
return def;
|
|
38
|
+
}
|
|
39
|
+
exports.createTyposDef = createTyposDef;
|
|
40
|
+
function extractAllSuggestions(typosDef) {
|
|
41
|
+
const allSugs = (0, sync_1.pipe)(Object.values(typosDef), (0, sync_1.opFilter)(isDefined), (0, sync_1.opConcatMap)((v) => (Array.isArray(v) ? v : [v])));
|
|
42
|
+
return new Set(allSugs);
|
|
43
|
+
}
|
|
44
|
+
exports.extractAllSuggestions = extractAllSuggestions;
|
|
45
|
+
function extractIgnoreValues(typosDef, ignorePrefix) {
|
|
46
|
+
const sugs = extractAllSuggestions(typosDef);
|
|
47
|
+
const pfxLen = ignorePrefix.length;
|
|
48
|
+
const ignoreKeys = Object.keys(typosDef)
|
|
49
|
+
.filter((k) => k.startsWith(ignorePrefix))
|
|
50
|
+
.map((k) => k.slice(pfxLen));
|
|
51
|
+
return (0, sync_1.reduce)(ignoreKeys, (sugs, word) => sugs.add(word), sugs);
|
|
52
|
+
}
|
|
53
|
+
exports.extractIgnoreValues = extractIgnoreValues;
|
|
54
|
+
function isDefined(v) {
|
|
55
|
+
return v !== undefined && v !== null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpellingDictionary } from './SpellingDictionary';
|
|
2
|
+
import { type TypoEntry, type TyposDef } from './Typos';
|
|
3
|
+
/**
|
|
4
|
+
* Create a dictionary where all words are to be forbidden.
|
|
5
|
+
* @param entries - list of Typos Entries
|
|
6
|
+
* @param name
|
|
7
|
+
* @param source
|
|
8
|
+
* @param options
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare function createTyposDictionary(entries: string[] | TyposDef | readonly TypoEntry[], name: string, source: string): SpellingDictionary;
|
|
12
|
+
//# sourceMappingURL=TyposDictionary.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTyposDictionary = void 0;
|
|
4
|
+
const sync_1 = require("@cspell/cspell-pipe/sync");
|
|
5
|
+
const Typos_1 = require("./Typos");
|
|
6
|
+
const util_1 = require("./Typos/util");
|
|
7
|
+
const symIgnore = Symbol('ignored');
|
|
8
|
+
class TyposDictionary {
|
|
9
|
+
constructor(name, source, typosDef, ignoreList) {
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.source = source;
|
|
12
|
+
this.typosDef = typosDef;
|
|
13
|
+
this.containsNoSuggestWords = false;
|
|
14
|
+
this.options = {};
|
|
15
|
+
this.type = 'typos';
|
|
16
|
+
this.isDictionaryCaseSensitive = true;
|
|
17
|
+
this.size = Object.keys(typosDef).length;
|
|
18
|
+
this.ignoreWords = new Set((0, sync_1.pipe)((0, util_1.extractIgnoreValues)(typosDef, '!'), (0, sync_1.opAppend)(ignoreList || [])));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A Forbidden word list does not "have" valid words.
|
|
22
|
+
* Therefore it always returns false.
|
|
23
|
+
* @param _word - the word
|
|
24
|
+
* @param _options - options
|
|
25
|
+
* @returns always false
|
|
26
|
+
*/
|
|
27
|
+
has(_word, _options) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
/** A more detailed search for a word, might take longer than `has` */
|
|
31
|
+
find(word, _options) {
|
|
32
|
+
const found = this._findForms(word);
|
|
33
|
+
return typeof found === 'string' ? { found, forbidden: true, noSuggest: false } : undefined;
|
|
34
|
+
}
|
|
35
|
+
_findForms(word) {
|
|
36
|
+
const f = this._find(word);
|
|
37
|
+
if (f !== false)
|
|
38
|
+
return f;
|
|
39
|
+
const lcWord = word.toLowerCase();
|
|
40
|
+
if (lcWord === word)
|
|
41
|
+
return false;
|
|
42
|
+
return this._find(lcWord);
|
|
43
|
+
}
|
|
44
|
+
_find(word) {
|
|
45
|
+
if (this.ignoreWords.has(word))
|
|
46
|
+
return symIgnore;
|
|
47
|
+
if (word in this.typosDef)
|
|
48
|
+
return word;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
isForbidden(word) {
|
|
52
|
+
const found = this._findForms(word);
|
|
53
|
+
return typeof found === 'string';
|
|
54
|
+
}
|
|
55
|
+
isNoSuggestWord(_word, _options) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
suggest(word) {
|
|
59
|
+
return this._suggest(word) || this._suggest(word.toLowerCase()) || [];
|
|
60
|
+
}
|
|
61
|
+
_suggest(word) {
|
|
62
|
+
if (this.ignoreWords.has(word))
|
|
63
|
+
return [];
|
|
64
|
+
if (!(word in this.typosDef))
|
|
65
|
+
return undefined;
|
|
66
|
+
const sug = this.typosDef[word];
|
|
67
|
+
if (!sug)
|
|
68
|
+
return [];
|
|
69
|
+
if (typeof sug === 'string') {
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
word: sug,
|
|
73
|
+
cost: 1,
|
|
74
|
+
isPreferred: true,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
return sug.map((word, index) => ({ word, cost: index + 1 }));
|
|
79
|
+
}
|
|
80
|
+
genSuggestions(collector) {
|
|
81
|
+
const sugs = this.suggest(collector.word);
|
|
82
|
+
sugs.forEach((result) => collector.add(result));
|
|
83
|
+
}
|
|
84
|
+
mapWord(word) {
|
|
85
|
+
return word;
|
|
86
|
+
}
|
|
87
|
+
getErrors() {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a dictionary where all words are to be forbidden.
|
|
93
|
+
* @param entries - list of Typos Entries
|
|
94
|
+
* @param name
|
|
95
|
+
* @param source
|
|
96
|
+
* @param options
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
function createTyposDictionary(entries, name, source) {
|
|
100
|
+
const def = (0, Typos_1.processEntriesToTyposDef)(entries);
|
|
101
|
+
return new TyposDictionary(name, source, def);
|
|
102
|
+
}
|
|
103
|
+
exports.createTyposDictionary = createTyposDictionary;
|
|
104
|
+
//# sourceMappingURL=TyposDictionary.js.map
|
package/dist/util/repMap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CharacterSet, ReplaceMap } from '@cspell/cspell-types';
|
|
2
|
-
export
|
|
2
|
+
export type ReplaceMapper = (src: string) => string;
|
|
3
3
|
export declare function createMapper(repMap: ReplaceMap | undefined, ignoreCharset?: string): ReplaceMapper;
|
|
4
4
|
declare function charsetToRepMap(charset: CharacterSet | undefined, replaceWith?: string): ReplaceMap | undefined;
|
|
5
5
|
declare function createMapperRegExp(repMap: ReplaceMap): RegExp;
|
package/dist/util/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-dictionary",
|
|
3
|
-
"version": "6.14.
|
|
3
|
+
"version": "6.14.3",
|
|
4
4
|
"description": "A spelling dictionary library useful for checking words and getting suggestions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"node": ">=14"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/jest": "^29.2.
|
|
41
|
+
"@types/jest": "^29.2.3",
|
|
42
42
|
"jest": "^29.3.1",
|
|
43
43
|
"ts-jest": "^29.0.3"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@cspell/cspell-pipe": "6.14.
|
|
47
|
-
"@cspell/cspell-types": "6.14.
|
|
48
|
-
"cspell-trie-lib": "6.14.
|
|
46
|
+
"@cspell/cspell-pipe": "6.14.3",
|
|
47
|
+
"@cspell/cspell-types": "6.14.3",
|
|
48
|
+
"cspell-trie-lib": "6.14.3",
|
|
49
49
|
"fast-equals": "^4.0.3",
|
|
50
50
|
"gensequence": "^4.0.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "df0efdbb0dc7b084579130ba5fe97441c0ab67ca"
|
|
53
53
|
}
|