Code Monkey home page Code Monkey logo

node-personal-data-filter's Introduction

node-personal-data-filter

What will be filtered:

  • JS objects
    • recursive
    • properties with special names like password, email etc. will be filtered even if they don't contain personal data (list of personal data properties)
  • Arrays
    • each item will be checked
  • Strings
    • Emails
    • GUIDs
    • IP v4
    • IP v6

Usage:

const pdf = require("node-personal-data-filter");
const f = pdf.newFilter({personalDataMask: "*****"});

const data = {
	filterMe: "[email protected]", // will be filtered
	dontFilterMe: "some-data",
	nextLevel: {
		filterMe: "1fec999a-7e81-4bce-8b32-1b6ddd144f1b", // will be filtered
		dontFilterMe: "some-data",
		email: "not-personal" // will be filtered
	},
	email: "[email protected]" // will be filtered
};

const filtered = f.filter(data);
console.log(filtered);

Configuration:

  • Mask:
const pdf = require("node-personal-data-filter");

const cfg = {
	personalDataMask: "*****" // The string which will be used to replace the personal data.
};

const f = pdf.newFilter(cfg);
  • Personal data properties:
const pdf = require("node-personal-data-filter");

const cfg = {
	personalDataProperties: ["pd1", "pd2"] // The personal data properties which will be filtered in JS object.
};

const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");

const cfg = {
	additionalPersonalDataProperties: ["pd1", "pd2"] // The personal data properties which will be added to the default ones for filtering JS object.
};

const f = pdf.newFilter(cfg);
  • Regular expressions:
const pdf = require("node-personal-data-filter");

const cfg = {
	regularExpression: "[a-z]" // The regular expression which will be used for filtering strings.
};

const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");

const cfg = {
	additionalRegularExpressions: ["[a-b]", "[c-d]"] // The regular expressions which will added to the default ones for filtering strings.
};

const f = pdf.newFilter(cfg);
  • Match replacers:
const pdf = require("node-personal-data-filter");

const cfg = {
	useDefaultMatchReplacer: true // Use the default match replacer - sha256 sum.
};

const f = pdf.newFilter(cfg);
const pdf = require("node-personal-data-filter");

const cfg = {
	matchReplacer: match => `not a secret - ${match}` // Set custom match replacer.
};

const f = pdf.newFilter(cfg);

node-personal-data-filter's People

Contributors

tsvetanmilanov avatar mbektchiev avatar mitko-kerezov avatar

Watchers

Fatme avatar James Cloos avatar Svetozar Toskov avatar Lyubomir Dokov avatar  avatar  avatar Tsvetelina Ivanova avatar Toma Nikolov avatar  avatar Alex Hitrov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.