New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-personal-data-filter

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-personal-data-filter - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0-dev

2

index.d.ts

@@ -11,3 +11,3 @@ declare module PersonalDataFilter {

*/
additionalRegularExpressions?: string[];
additionalRegularExpressions?: (string | RegExp)[];

@@ -14,0 +14,0 @@ /**

@@ -94,10 +94,15 @@ "use strict";

_filterString(input) {
if (this._matchReplacer) {
return input.replace(this._filterRegExp, this._matchReplacer);
_replaceAll(input, replaceValue) {
let result = input;
for (const filterRegExp of this._filterRegExps) {
result = result.replace(filterRegExp, replaceValue)
}
return input.replace(this._filterRegExp, this._mask)
return result;
}
_filterString(input) {
return this._replaceAll(input, this._matchReplacer || this._mask);
}
_setRegularExpressions(config) {

@@ -110,13 +115,16 @@ const additionalRegularExpressionsSize = _.size(config.additionalRegularExpressions);

if (config.regularExpression) {
this._filterRegExp = config.regularExpression;
this._filterRegExps = [config.regularExpression];
return;
}
let regExps = _.concat([], defaultRegularExpressions);
let stringRegExps = _.concat([], defaultRegularExpressions);
let additionalRegExpObjects = [];
if (additionalRegularExpressionsSize > 0) {
regExps = _.concat(regExps, config.additionalRegularExpressions);
const additionalRegularExpressionStrings = _.filter(config.additionalRegularExpressions, expression => typeof expression === "string");
additionalRegExpObjects = _.difference(config.additionalRegularExpressions, additionalRegularExpressionStrings);
stringRegExps = _.concat(stringRegExps, additionalRegularExpressionStrings);
}
const regExpString = regExps.map(r => `(${r})`).join("|");
this._filterRegExp = new RegExp(regExpString, "gi");
const regExpString = stringRegExps.map(r => `(${r})`).join("|");
this._filterRegExps = [new RegExp(regExpString, "gi"), ...additionalRegExpObjects];
}

@@ -123,0 +131,0 @@

{
"name": "node-personal-data-filter",
"version": "0.4.0",
"version": "0.5.0-dev",
"description": "node-personal-data-filter",

@@ -5,0 +5,0 @@ "main": "index.js",

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