Skip to content

myke11j/censor-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

censor-json

JSON redacting library for nodejs

Install

npm install --save censor-json

Usage

Its usage is quite simple. You will need two things

  • A json object which you want to redact/censor
  • A mapping object, i.e, array of paths which will be redacted.
const censorData = require('censor-json');
censorData.redact(mapping, data);

Demo

const censorData = require('censor-json');
const data = {
    name: 'Ned Stark',
    house: 'Stark'
    details: {
        reason_of_death: 'honor',
        killed_by: 'Illyn payne, Joffery, Baelish'
    },
    motto: 'Winter is Coming!'
}

const mapping = {
    { path: 'name' },
    { path: 'motto' },
    { path: 'details.reason_of_death' }
}

censorData.redact(mapping, data); 

/*
Output: {
    name: 'N*d *ta**',
    house: 'Stark'
    details: {
        reason_of_death: '*on**',
        killed_by: 'Illyn payne, Joffery, Baelish'
    },
    motto: '*i**er i* C*m**g!'
}
*/

Future

In future version I will be adding more features like

  • zipping of files
  • uploading to S3

If more features you want to be in this package, please let me know by creating a request here.

Also use this link to let me know of any bugs or issues.

About

JSON redacting library for nodejs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •