cspell-trie-lib 6.13.0 → 6.13.2
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.
|
@@ -22,9 +22,14 @@ export interface ParseDictionaryOptions {
|
|
|
22
22
|
stripCaseAndAccents: boolean;
|
|
23
23
|
/**
|
|
24
24
|
* Tell the parser to keep non-case/accent version in both forms.
|
|
25
|
-
* @default
|
|
25
|
+
* @default false
|
|
26
26
|
*/
|
|
27
27
|
stripCaseAndAccentsKeepDuplicate: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Tell the parser to keep non-case/accent version in both forms.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
stripCaseAndAccentsOnForbidden: boolean;
|
|
28
33
|
/**
|
|
29
34
|
* Tell the parser to split into words along spaces.
|
|
30
35
|
* @default false
|
|
@@ -14,7 +14,8 @@ const _defaultOptions = {
|
|
|
14
14
|
caseInsensitivePrefix: constants_1.CASE_INSENSITIVE_PREFIX,
|
|
15
15
|
keepExactPrefix: constants_1.IDENTITY_PREFIX,
|
|
16
16
|
stripCaseAndAccents: true,
|
|
17
|
-
stripCaseAndAccentsKeepDuplicate:
|
|
17
|
+
stripCaseAndAccentsKeepDuplicate: false,
|
|
18
|
+
stripCaseAndAccentsOnForbidden: false,
|
|
18
19
|
split: false,
|
|
19
20
|
splitKeepBoth: false,
|
|
20
21
|
splitSeparator: RegExpSplit,
|
|
@@ -30,7 +31,7 @@ exports.setOfCSpellDirectiveFlags = ['no-split', 'split', 'generate-alternatives
|
|
|
30
31
|
*/
|
|
31
32
|
function createDictionaryLineParserMapper(options) {
|
|
32
33
|
const _options = options || _defaultOptions;
|
|
33
|
-
const { commentCharacter = _defaultOptions.commentCharacter, optionalCompoundCharacter: optionalCompound = _defaultOptions.optionalCompoundCharacter, compoundCharacter: compound = _defaultOptions.compoundCharacter, caseInsensitivePrefix: ignoreCase = _defaultOptions.caseInsensitivePrefix, forbiddenPrefix: forbidden = _defaultOptions.forbiddenPrefix, keepExactPrefix: keepCase = _defaultOptions.keepExactPrefix, splitSeparator = _defaultOptions.splitSeparator, splitKeepBoth = _defaultOptions.splitKeepBoth, stripCaseAndAccentsKeepDuplicate = _defaultOptions.stripCaseAndAccentsKeepDuplicate, } = _options;
|
|
34
|
+
const { commentCharacter = _defaultOptions.commentCharacter, optionalCompoundCharacter: optionalCompound = _defaultOptions.optionalCompoundCharacter, compoundCharacter: compound = _defaultOptions.compoundCharacter, caseInsensitivePrefix: ignoreCase = _defaultOptions.caseInsensitivePrefix, forbiddenPrefix: forbidden = _defaultOptions.forbiddenPrefix, keepExactPrefix: keepCase = _defaultOptions.keepExactPrefix, splitSeparator = _defaultOptions.splitSeparator, splitKeepBoth = _defaultOptions.splitKeepBoth, stripCaseAndAccentsKeepDuplicate = _defaultOptions.stripCaseAndAccentsKeepDuplicate, stripCaseAndAccentsOnForbidden = _defaultOptions.stripCaseAndAccentsOnForbidden, } = _options;
|
|
34
35
|
let { stripCaseAndAccents = _defaultOptions.stripCaseAndAccents, split = _defaultOptions.split } = _options;
|
|
35
36
|
// console.log('options: %o', options);
|
|
36
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -93,8 +94,11 @@ function createDictionaryLineParserMapper(options) {
|
|
|
93
94
|
yield line;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
const doNotNormalizePrefix =
|
|
97
|
-
[
|
|
97
|
+
const doNotNormalizePrefix = Object.create(null);
|
|
98
|
+
[ignoreCase, keepCase, '"'].forEach((prefix) => (doNotNormalizePrefix[prefix] = true));
|
|
99
|
+
if (!stripCaseAndAccentsOnForbidden) {
|
|
100
|
+
doNotNormalizePrefix[forbidden] = true;
|
|
101
|
+
}
|
|
98
102
|
function removeDoublePrefix(w) {
|
|
99
103
|
return w.startsWith(ignoreCase + ignoreCase) ? w.slice(1) : w;
|
|
100
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-trie-lib",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.2",
|
|
4
4
|
"description": "Trie Data Structure to support cspell.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cspell/cspell-pipe": "
|
|
41
|
-
"@cspell/cspell-types": "
|
|
40
|
+
"@cspell/cspell-pipe": "6.13.2",
|
|
41
|
+
"@cspell/cspell-types": "6.13.2",
|
|
42
42
|
"fs-extra": "^10.1.0",
|
|
43
43
|
"gensequence": "^4.0.2"
|
|
44
44
|
},
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@cspell/dict-en_us": "^3.0.0",
|
|
50
50
|
"@cspell/dict-es-es": "^2.2.2",
|
|
51
51
|
"@types/fs-extra": "^9.0.13",
|
|
52
|
-
"@types/node": "^18.11.
|
|
52
|
+
"@types/node": "^18.11.8",
|
|
53
53
|
"jest": "^29.2.2",
|
|
54
54
|
"rimraf": "^3.0.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "269c26afe8c5829b09e5ef731a30a2949d7c63e1"
|
|
57
57
|
}
|