node-personal-data-filter
What will be filtered:
- JS objects
- Arrays
- each item will be checked
- Strings
Usage:
const pdf = require("node-personal-data-filter");
const f = pdf.newFilter({personalDataMask: "*****"});
const data = {
filterMe: "some@mail.com",
dontFilterMe: "some-data",
nextLevel: {
filterMe: "1fec999a-7e81-4bce-8b32-1b6ddd144f1b",
dontFilterMe: "some-data",
email: "not-personal"
},
email: "some@mail.bg"
};
const filtered = f.filter(data);
console.log(filtered);
Configuration:
const pdf = require("node-personal-data-filter");
const cfg = {
personalDataMask: "*****"
};
const f = pdf.newFilter(cfg);
- Personal data properties:
const pdf = require("node-personal-data-filter");
const cfg = {
personalDataProperties: ["pd1", "pd2"]
};
const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");
const cfg = {
additionalPersonalDataProperties: ["pd1", "pd2"]
};
const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");
const cfg = {
regularExpression: "[a-z]"
};
const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");
const cfg = {
additionalRegularExpressions: ["[a-b]", "[c-d]"]
};
const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");
const cfg = {
useDefaultMatchReplacer: true
};
const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");
const cfg = {
matchReplacer: match => `not a secret - ${match}`
};
const f = pdf.newFilter(cfg);