censor_it 2.0.0
censor_it: ^2.0.0 copied to clipboard
A Dart library for censoring text based on predefined patterns and customizable characters.
2.0.0 #
Breaking Changes #
- Main constructor replaced with factory constructors - Use
CensorIt.random(),CensorIt.mask(),CensorIt.builder(), orCensorIt.replace() CensorPatternrenamed toLanguagePattern- Better semantic naming- Changed from
enumtosealed class- Better type safety and extensibility - Removed
regenerateCensoredText()- Useregenerate()instead (only forCensorIt.random()) - Removed
toCensorIt()extension - Use factory constructors directly fromPatterns()renamed tomulti()-CensorPattern.multi([...])- SDK minimum version raised to
^3.10.0
Added #
CensorIt.random()factory - Random character replacement (replaces old constructor)CensorIt.mask()factory - Simple character masking (e.g.,****)CensorIt.builder()factory - Custom replacement logic with builder functionCensorIt.replace()factory - Fixed string replacement (e.g.,[censored])- Locale-based pattern selection -
LanguagePattern.fromLocale('lv') - Multi-locale patterns -
LanguagePattern.fromLocales(['en', 'ru', 'es']) - Simplified
.censored()extension - Direct string censoring CensorIt.defaultCharsconstant - Reference default censoring characters- Better validation - Validates single-character elements and non-empty lists
Fixed #
- Case preservation bug - Censored text now correctly maintains original case
- Custom pattern independence - Each custom pattern has its own RegExp instance
- Factory constructor bug - Multiple calls no longer interfere with each other
- Infinite loop protection - Added fallback mechanism for edge cases
Changed #
- Constructor replaced with factory methods for different strategies
- Pattern class renamed:
CensorPattern→LanguagePattern - Combining patterns:
fromPatterns()→CensorPattern.multi() - File structure reorganized into
core/,patterns/,extensions/
Removed #
toCensorIt()extension method- Default
CensorIt()constructor regenerateCensoredText()method
Migration Guide #
See MIGRATION.md for detailed step-by-step instructions.
1.2.4 #
- Set type annotation on CensorPattern static methods
- Update README.md
- Update example
- Update pubspec.yaml
1.2.3 #
- Update README.md
1.2.2 #
- Update README.md
1.2.1 #
- Update README.md
- Update LICENSE
- Update example
1.2.0 #
- Refactored regexps
- Added regexps tests
- Deprecated stream
1.1.1 #
- Update README.md
1.1.0 #
- Added extension [CensorIt] on [String]
1.0.4 #
- Enum changes
1.0.3 #
- Removed bang operator
1.0.2 #
- Updated docs.
1.0.1 #
- Updated docs.
1.0.0 #
- Initial version.
