2.4 KiB
fr/wikipedia — French Wikipedia frequency dictionary
(no submodules)
Purpose
Frequency-ranked dictionary of the most common French tokens observed in
Wikipedia. Plugs into assess for French-locale strength evaluation. The
default entry list is small to keep the package bundle compact;
production deployments should swap in a fuller list via loadDictionaries.
Features
- Frozen
ReadonlyMap<string, number>keyed by lowercase token - Covers high-frequency French stopwords and common nouns
- Swappable at runtime via
loadDictionaries
Usage: Basic Example
import { FR_WIKIPEDIA_DICTIONARY } from "@suaveplan/password-strength/dicts/fr";
console.log(FR_WIKIPEDIA_DICTIONARY.get("de")); // 2
Usage: Advanced Example
import { assess } from "@suaveplan/password-strength";
import { FR_DICTIONARIES } from "@suaveplan/password-strength/dicts/fr";
const result = assess("motdepasse123", { dictionaries: FR_DICTIONARIES });
console.log(result.score);
API Reference
FR_WIKIPEDIA_DICTIONARY: ReadonlyMap<string, number>— frozen frequency-ranked French Wikipedia dictionary.
Implementation Notes
The list is intentionally a subset of the full Wikipedia frequency list.
The default entries are diacritic-free where possible to keep matching
against typed passwords robust against keyboard variants; consumers who
need diacritic-preserving matches should preprocess input via a NFC
normaliser before calling assess.
Additional Implementation Notes
The implementation follows the canonical zxcvbn algorithm from Wheeler 2016 with
the suaveplan-style additions described in the package proposal: structured error
codes via the defineCodes registry, Zod boundaries at every public entry
point, OTel histograms and counters keyed to low-cardinality attributes, and
a strict input-length guard at 200 characters. Consumers integrate with their
existing observability stack by installing a meter provider before importing
the package, and with their i18n stack via the MessageResolver callback type
declared in @suaveplan/types. The bundled data tables are intentionally
small to keep the package bundle compact; production deployments should swap
in fuller frequency-ranked tables via loadDictionaries. The default English
dictionary set is a frozen DictionarySet that the matcher never mutates;
caller-supplied dictionaries override defaults by name.