csvdataanonymizer
v1.0.0
Published
A simple CSV data anonymization utility module for Node.js.
Downloads
2
Readme
csvdataanonymizer
This is a simple CSV data anonymization utility module for Node.js.
Installation
To install the package, use npm:
npm install csvdataanonymizer
Usage
const csvdataanonymizer = require('csvdataanonymizer');
// Example CSV data
const csvData = `ID,Name,Email,Phone
123,John Doe,[email protected],555-1234
456,Alice Smith,[email protected],555-5678
789,Bob Johnson,[email protected],555-9012`;
// Anonymization rules
const anonymizationRules = {
'Name': name => name.split(' ')[0] + ' ***',
'Email': email => '***@example.com',
'Phone': phone => '***-****'
};
// Anonymize CSV data
const anonymizedCSV = csvdataanonymizer.anonymizeCSV(csvData, anonymizationRules);
console.log(anonymizedCSV);
API
anonymizeCSV(csvData, anonymizationRules)
Anonymizes the given CSV data according to the specified anonymization rules.
csvData
: The CSV data to anonymize.anonymizationRules
: An object containing anonymization rules for each CSV field. Each rule should be a function that takes a field value as input and returns the anonymized value.
Returns the anonymized CSV data.
License
This package is licensed under the MIT License.