Skip to content

SARAVANAN29/XmlMasking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xmlmasking

a package for xml masking. It has 2 methods, xmlSanitize, xmlJsonSanitize

  1. xmlSanitize – For xml alone.
  2. xmlJsonSanitize – For xml inside json.

Installation

$ npm install xmlmasking

Usage

    const {xmlSanitize, xmlJsonSanitize} = require("xmlmasking");
    var json = {a:`<sara attr=true>1234</sara>`};
    var xml = `<sara attr=true>1234</sara>`;
    console.log(xmlJsonSanitize(json, [‘key’], ['attr'])); // {"a":"<sara attr="******">1234</sara>"}
    console.log(xmlJsonSanitize(json, [‘sara’])); // {"a":"<sara>******</sara>"}
    console.log(xmlSanitize(xml, [‘sara’])); // <sara>******</sara>

Notes

Syntax :

  1. exports.xmlSanitize = function(xml, sanitizeArray, attributeArray, splRegex, optionObj) {}
  2. exports.xmlJsonSanitize = function(json, sanitizeArray, attributeArray, splRegex, optionObj) {}

splRegex -> If any special kind of regex need to add means, we can mention that string

optionObj -> { ignoreCase = true, replacement = "******", regexOpt = `` }

regexOpt -> like single match, other addtional properties for regex.

First 2 arguments are mandatory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published