Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bad-words-next

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bad-words-next - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

7

CHANGELOG.md
# Changelog
## [2.2.0](https://github.com/alexzel/bad-words-next/compare/v2.1.0...v2.2.0) (2023-06-21)
### Features
* implement placeholderMode to address the feature request ([5aa1b76](https://github.com/alexzel/bad-words-next/commit/5aa1b763a0940383c3fa8676d5250050b13812d4))
## [2.1.0](https://github.com/alexzel/bad-words-next/compare/v2.0.1...v2.1.0) (2023-06-04)

@@ -4,0 +11,0 @@

14

lib/index.d.ts

@@ -6,2 +6,7 @@ /**

/**
* Placeholder mode to either replace with or repeat the placeholder
* @type {String}
*/
type PlaceholderMode = 'repeat' | 'replace';
/**
* Dictionary data format

@@ -42,2 +47,8 @@ */

/**
* Placeholder mode to either replace with or repeat the placeholder
* @defaultValue <code>'replace'</code>
* @type {[type]}
*/
placeholderMode?: PlaceholderMode;
/**
* Special chars to allow on start and/or end of a word

@@ -71,2 +82,3 @@ * @defaultValue <code>/\d|[!@#$%^&*()[\\];:'",.?\\-_=+~`|]|a|(?:the)|(?:el)|(?:la)/</code>

placeholder: string;
placeholderMode: PlaceholderMode;
specialChars: RegExp;

@@ -176,2 +188,2 @@ spaceChars: string[];

export { Data, Lookalike, Options, BadWordsNext as default };
export { Data, Lookalike, Options, PlaceholderMode, BadWordsNext as default };

@@ -154,2 +154,3 @@ import { remove } from 'confusables';

placeholder: '***',
placeholderMode: 'replace',
specialChars: /\d|[!@#$%^&*()[\];:'",.?\-_=+~`|]|a|(?:the)|(?:el)|(?:la)/,

@@ -287,2 +288,5 @@ spaceChars: ['', '.', '-', ';', '|'],

}
if (_this2.opts.placeholderMode === 'repeat') {
return _this2.opts.placeholder.repeat(word.length);
}
return _this2.opts.placeholder;

@@ -289,0 +293,0 @@ }

2

package.json
{
"name": "bad-words-next",
"version": "2.1.0",
"version": "2.2.0",
"description": "JavaScript/TypeScript filter and checker for bad words aka profanity",

@@ -5,0 +5,0 @@ "keywords": [

@@ -84,5 +84,3 @@ # bad-words-next

interface Lookalike {
[key: string | number]: string // Simple key-value object
}
type Lookalike = Record<string | number, string> // Simple key-value object
```

@@ -102,2 +100,3 @@

placeholder?: string // Filter placeholder - default '***'
placeholderMode?: 'repeat' | 'replace' // Placeholder mode to either replace with or repeat the placeholder - default 'replace'
specialChars?: RegExp // Special chars to allow on start and/or end of a word - default /\d|[!@#$%^&*()[\];:'",.?\-_=+~`|]|a|(?:the)|(?:el)|(?:la)/

@@ -104,0 +103,0 @@ spaceChars?: string[] // Pseudo space chars, a list of values for `_` symbol in a dictionary word string - default ['', '.', '-', ';', '|']

@@ -62,2 +62,7 @@ import BadWordsNext from '../src'

})
it('filters and replaces with repeated placeholder', () => {
const badwords = new BadWordsNext({ data: en, placeholder: '#', placeholderMode: 'repeat' })
expect(badwords.filter('$h1ttt')).toBe('######')
})
})

@@ -64,0 +69,0 @@ })

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc