Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xml2

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml2 - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

18

index.js

@@ -16,4 +16,4 @@ const fs = require('fs');

const source = await readFile(filename, 'utf8');
const dom = await XML.read(`<root>${source}</root>`, options);
return dom.children;
const ast = await XML.read(`<root>${source}</root>`, options);
return ast.children;
}

@@ -26,4 +26,18 @@ static serialize(ast, options){

}
static transform(source, options = {}){
const { plugins = [] } = options;
const ast = await XML.read(source);
const visitors = plugins
.map(plugin => plugin(ast))
.filter(Boolean);
XML.traverse(ast, node => {
visitors.forEach(visitor => {
const fn = visitor[node.name];
typeof fn === 'function' && fn(node);
});
});
return XML.serialize(ast, options);
}
}
module.exports = XML;

2

package.json
{
"name": "xml2",
"version": "0.0.5",
"version": "0.0.6",
"description": "simple xml reader and parser",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc