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 1.6.8 to 2.0.0

lib/index.cjs

21

CHANGELOG.md
# Changelog
## [2.0.0](https://github.com/alexzel/bad-words-next/compare/v1.6.8...v2.0.0) (2023-06-02)
### ⚠ BREAKING CHANGES
* convert benchmark to esm
* fix rollup build
* fix ts warnings and use different types
* convert package to esm and bump latest dependencies
### Features
* convert package to esm and bump latest dependencies ([479824a](https://github.com/alexzel/bad-words-next/commit/479824a6e3ecaef467443b6b57a488ea9a4d394f))
### Bug Fixes
* convert benchmark to esm ([28ea0f3](https://github.com/alexzel/bad-words-next/commit/28ea0f3164df538de124fb993e44edfcf7ecd87a))
* fix rollup build ([d73190e](https://github.com/alexzel/bad-words-next/commit/d73190ee4dcc12a2a451f88f218706a2755fc0e0))
* fix ts warnings and use different types ([1044011](https://github.com/alexzel/bad-words-next/commit/1044011d103a8163dcd422770c98783a82fa9a26))
## [1.6.8](https://github.com/alexzel/bad-words-next/compare/v1.6.7...v1.6.8) (2023-06-02)

@@ -4,0 +25,0 @@

14

lib/index.d.ts
/**
* Simple key-value object for homoglyphs conversion
*/
interface Lookalike {
[key: string | number]: string;
}
type Lookalike = Record<string | number, string>;
/**

@@ -94,5 +92,3 @@ * Dictionary data format

*/
interface InternalDataMap {
[key: string]: InternalData;
}
type InternalDataMap = Record<string, InternalData>;
/**

@@ -129,5 +125,5 @@ * Main library class implementing profanity filtering and detection

* @private
* @type {Function}
* @type {() => void}
*/
clear: Function;
clear: () => void;
/**

@@ -168,3 +164,3 @@ * Create an instance of BadWordsNext class

*/
check(str: string): Boolean;
check(str: string): boolean;
/**

@@ -171,0 +167,0 @@ * Filter bad words in the input string and replace them with a placeholder

@@ -1,10 +0,4 @@

'use strict';
import { remove } from 'confusables';
import moize from 'moize';
var confusables = require('confusables');
var moize = require('moize');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var moize__default = /*#__PURE__*/_interopDefaultLegacy(moize);
function ownKeys(object, enumerableOnly) {

@@ -172,3 +166,3 @@ var keys = Object.keys(object);

this.ids = [];
var memoized = moize__default["default"](this.check, {
var memoized = moize(this.check, {
maxSize: this.opts.maxCacheSize

@@ -222,4 +216,4 @@ });

}
for (var _key in data.lookalike) {
var esc = escapeRegexpString(_key);
for (var key in data.lookalike) {
var esc = escapeRegexpString(key);
lookalike += lookalike !== '' ? "|".concat(esc) : esc;

@@ -252,3 +246,3 @@ }

}
return this.opts.confusables.includes(id) ? confusables.remove(s) : s;
return this.opts.confusables.includes(id) ? remove(s) : s;
}

@@ -283,3 +277,3 @@ }, {

var _this2 = this;
if (str === '' || this.check(str) === false) return str;
if (str === '' || !this.check(str)) return str;
var delims = [];

@@ -292,3 +286,3 @@ var re = /([\b\s])/g;

return str.split(/[\b\s]/).map(function (word) {
if (_this2.check(word) === true) {
if (_this2.check(word)) {
if (onCatch !== undefined) {

@@ -308,2 +302,2 @@ onCatch(word);

module.exports = BadWordsNext;
export { BadWordsNext as default };
{
"name": "bad-words-next",
"version": "1.6.8",
"version": "2.0.0",
"description": "JavaScript/TypeScript filter and checker for bad words aka profanity",

@@ -35,4 +35,14 @@ "keywords": [

},
"main": "lib/index.js",
"module": "lib/index.mjs",
"type": "module",
"exports": {
"./package.json": "./package.json",
"./data/*": "./data/*",
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"default": "./lib/index.js"
}
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "lib/index.d.ts",

@@ -45,27 +55,27 @@ "files": [

"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/plugin-transform-typescript": "^7.20.13",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@commitlint/cli": "^17.5.1",
"@commitlint/config-conventional": "^17.4.4",
"@rollup/plugin-babel": "^5.3.1",
"@types/jest": "^29.2.5",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^8.32.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"@babel/core": "^7.22.1",
"@babel/plugin-transform-typescript": "^7.22.3",
"@babel/preset-env": "^7.22.4",
"@babel/preset-typescript": "^7.21.5",
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@rollup/plugin-babel": "^6.0.3",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"eslint": "^8.41.0",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"husky": "^8.0.3",
"jest": "^29.2.6",
"rollup": "^2.79.1",
"jest": "^29.5.0",
"rollup": "^3.23.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^4.2.3",
"tinybench": "^2.3.1",
"typedoc": "^0.23.24",
"typedoc-github-wiki-theme": "^1.0.1",
"typedoc-plugin-markdown": "^3.14.0",
"typedoc-plugin-rename-defaults": "^0.6.4",
"rollup-plugin-dts": "^5.3.0",
"tinybench": "^2.5.0",
"typedoc": "^0.24.7",
"typedoc-github-wiki-theme": "^1.1.0",
"typedoc-plugin-markdown": "^3.15.3",
"typedoc-plugin-rename-defaults": "^0.6.5",
"typescript": "^4.9.4"

@@ -75,3 +85,3 @@ },

"confusables": "^1.1.1",
"moize": "^6.1.5"
"moize": "^6.1.6"
},

@@ -78,0 +88,0 @@ "babel": {

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