cspell-dictionary
Advanced tools
Comparing version 8.7.0 to 8.8.0
@@ -86,3 +86,3 @@ import { CASE_INSENSITIVE_PREFIX, CompoundWordsMethod } from 'cspell-trie-lib'; | ||
getErrors() { | ||
return this.dictionaries.reduce((errors, dict) => errors.concat(dict.getErrors?.() || []), []); | ||
return this.dictionaries.reduce((errors, dict) => [...errors, ...(dict.getErrors?.() || [])], []); | ||
} | ||
@@ -89,0 +89,0 @@ _isForbiddenInDict(word, ignoreCase) { |
@@ -15,3 +15,3 @@ import { opConcatMap, pipe } from '@cspell/cspell-pipe/sync'; | ||
source; | ||
static cachedWordsLimit = 50000; | ||
static cachedWordsLimit = 50_000; | ||
_size = 0; | ||
@@ -163,6 +163,4 @@ knownWords = new Set(); | ||
const r = cache.get(word); | ||
if (r !== undefined) { | ||
if (r.useCompounds === useCompounds && r.ignoreCase === ignoreCase) { | ||
return r.findResult; | ||
} | ||
if (r !== undefined && r.useCompounds === useCompounds && r.ignoreCase === ignoreCase) { | ||
return r.findResult; | ||
} | ||
@@ -169,0 +167,0 @@ const findResult = fn(word, useCompounds, ignoreCase); |
@@ -1,2 +0,2 @@ | ||
import assert from 'assert'; | ||
import assert from 'node:assert'; | ||
import { appendToDef, createTyposDef } from './util.js'; | ||
@@ -126,3 +126,3 @@ function assertString(v) { | ||
export function parseTyposFile(content) { | ||
const lines = splitIntoLines(content.replace(inlineComment, '')); | ||
const lines = splitIntoLines(content.replaceAll(inlineComment, '')); | ||
return reduceToTyposDef(lines); | ||
@@ -129,0 +129,0 @@ } |
@@ -1,2 +0,3 @@ | ||
function expand(pattern, options = { begin: '(', end: ')', sep: '|' }, start = 0) { | ||
function expand(pattern, options, start = 0) { | ||
const _options = options ?? { begin: '(', end: ')', sep: '|' }; | ||
const len = pattern.length; | ||
@@ -16,7 +17,7 @@ const parts = []; | ||
const ch = pattern[i++]; | ||
if (ch === options.end) { | ||
if (ch === _options.end) { | ||
break; | ||
} | ||
if (ch === options.begin) { | ||
const nested = expand(pattern, options, i); | ||
if (ch === _options.begin) { | ||
const nested = expand(pattern, _options, i); | ||
i = nested.idx; | ||
@@ -26,3 +27,3 @@ curWord = nested.parts.flatMap((p) => (Array.isArray(curWord) ? curWord.map((w) => w + p) : [curWord + p])); | ||
} | ||
if (ch === options.sep) { | ||
if (ch === _options.sep) { | ||
push(curWord); | ||
@@ -37,5 +38,5 @@ curWord = ''; | ||
} | ||
export function expandBraces(pattern, options = { begin: '(', end: ')', sep: '|' }) { | ||
return expand(pattern, options).parts; | ||
export function expandBraces(pattern, options) { | ||
return expand(pattern, options ?? { begin: '(', end: ')', sep: '|' }).parts; | ||
} | ||
//# sourceMappingURL=braceExpansion.js.map |
@@ -7,4 +7,4 @@ /** | ||
export function escapeRegEx(s) { | ||
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'); | ||
return s.replaceAll(/[|\\{}()[\]^$+*?.]/g, '\\$&').replaceAll('-', '\\x2d'); | ||
} | ||
//# sourceMappingURL=regexHelper.js.map |
@@ -10,3 +10,3 @@ import { expandCharacterSet } from 'cspell-trie-lib'; | ||
if (charsetMap) { | ||
repMap = repMap.concat(charsetMap); | ||
repMap = [...repMap, ...charsetMap]; | ||
} | ||
@@ -32,3 +32,3 @@ const filteredMap = repMap.filter(([match, _]) => !!match); | ||
.split('|') | ||
.map((chars) => `[${chars.replace(/[\][\\]/g, '\\$&')}]`) | ||
.map((chars) => `[${chars.replaceAll(/[\][\\]/g, '\\$&')}]`) | ||
.map((map) => [map, replaceWith]); | ||
@@ -58,7 +58,7 @@ } | ||
// fix up any nested () | ||
const r = s.match(/\(/) ? s.replace(/\((?=.*\))/g, '(?:').replace(/\(\?:\?/g, '(?') : s; | ||
const r = /\(/.test(s) ? s.replaceAll(/\((?=.*\))/g, '(?:').replaceAll('(?:?', '(?') : s; | ||
new RegExp(r); | ||
s = r; | ||
} | ||
catch (err) { | ||
catch { | ||
return escapeRegEx(s); | ||
@@ -131,3 +131,3 @@ } | ||
function createTrie(repMap, ignoreCharset) { | ||
const combined = [repMap, charsetToRepMap(ignoreCharset)].filter(isDefined).flatMap((a) => a); | ||
const combined = [repMap, charsetToRepMap(ignoreCharset)].filter(isDefined).flat(); | ||
const expanded = expandReplaceMap(combined); | ||
@@ -134,0 +134,0 @@ const trieRoot = Object.create(null); |
@@ -6,6 +6,6 @@ const regExFirstUpper = /^\p{Lu}\p{M}?\p{Ll}+$/u; | ||
export function isUpperCase(word) { | ||
return !!word.match(regExAllUpper); | ||
return !!regExAllUpper.test(word); | ||
} | ||
export function isLowerCase(word) { | ||
return !!word.match(regExAllLower); | ||
return !!regExAllLower.test(word); | ||
} | ||
@@ -25,9 +25,9 @@ export function isFirstCharacterUpper(word) { | ||
export function matchCase(example, word) { | ||
if (example.match(regExFirstUpper)) { | ||
if (regExFirstUpper.test(example)) { | ||
return word.slice(0, 1).toUpperCase() + word.slice(1).toLowerCase(); | ||
} | ||
if (example.match(regExAllLower)) { | ||
if (regExAllLower.test(example)) { | ||
return word.toLowerCase(); | ||
} | ||
if (example.match(regExAllUpper)) { | ||
if (regExAllUpper.test(example)) { | ||
return word.toUpperCase(); | ||
@@ -44,7 +44,7 @@ } | ||
export function removeAccents(text) { | ||
return text.normalize('NFD').replace(regExAccents, ''); | ||
return text.normalize('NFD').replaceAll(regExAccents, ''); | ||
} | ||
export function removeUnboundAccents(text) { | ||
return text.replace(regExAccents, ''); | ||
return text.replaceAll(regExAccents, ''); | ||
} | ||
//# sourceMappingURL=text.js.map |
{ | ||
"name": "cspell-dictionary", | ||
"version": "8.7.0", | ||
"version": "8.8.0", | ||
"description": "A spelling dictionary library useful for checking words and getting suggestions.", | ||
@@ -50,9 +50,9 @@ "type": "module", | ||
"dependencies": { | ||
"@cspell/cspell-pipe": "8.7.0", | ||
"@cspell/cspell-types": "8.7.0", | ||
"cspell-trie-lib": "8.7.0", | ||
"@cspell/cspell-pipe": "8.8.0", | ||
"@cspell/cspell-types": "8.8.0", | ||
"cspell-trie-lib": "8.8.0", | ||
"fast-equals": "^5.0.1", | ||
"gensequence": "^7.0.0" | ||
}, | ||
"gitHead": "5318079ed11fe77e981287ecf1c40d6f28dd91ed" | ||
"gitHead": "a42bce675c00cb2d51809b3ae3894119ea4f5ce7" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94238
2442
+ Added@cspell/cspell-pipe@8.8.0(transitive)
+ Added@cspell/cspell-types@8.8.0(transitive)
+ Addedcspell-trie-lib@8.8.0(transitive)
- Removed@cspell/cspell-pipe@8.7.0(transitive)
- Removed@cspell/cspell-types@8.7.0(transitive)
- Removedcspell-trie-lib@8.7.0(transitive)
Updated@cspell/cspell-pipe@8.8.0
Updated@cspell/cspell-types@8.8.0
Updatedcspell-trie-lib@8.8.0