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

xml2js

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml2js - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

49

lib/xml2js.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.1
// Generated by CoffeeScript 1.6.3
(function() {

@@ -6,3 +6,3 @@ var events, isEmpty, sax,

__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
_this = this;
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

@@ -59,3 +59,2 @@ sax = require('sax');

exports.ValidationError = (function(_super) {
__extends(ValidationError, _super);

@@ -72,14 +71,11 @@

exports.Parser = (function(_super) {
__extends(Parser, _super);
function Parser(opts) {
var key, value, _ref,
_this = this;
this.parseString = function(str, cb) {
return Parser.prototype.parseString.apply(_this, arguments);
};
this.reset = function() {
return Parser.prototype.reset.apply(_this, arguments);
};
this.parseString = __bind(this.parseString, this);
this.reset = __bind(this.reset, this);
var key, value, _ref;
if (!(this instanceof exports.Parser)) {
return new exports.Parser(opts);
}
this.options = {};

@@ -104,3 +100,3 @@ _ref = exports.defaults["0.2"];

Parser.prototype.reset = function() {
var attrkey, charkey, err, stack,
var attrkey, charkey, err, ontext, stack,
_this = this;

@@ -153,8 +149,11 @@ this.removeAllListeners();

this.saxParser.onclosetag = function() {
var node, nodeName, obj, old, s, xpath;
var cdata, emptyStr, node, nodeName, obj, old, s, xpath;
obj = stack.pop();
nodeName = obj["#name"];
delete obj["#name"];
cdata = obj.cdata;
delete obj.cdata;
s = stack[stack.length - 1];
if (obj[charkey].match(/^\s*$/)) {
if (obj[charkey].match(/^\s*$/) && !cdata) {
emptyStr = obj[charkey];
delete obj[charkey];

@@ -172,4 +171,4 @@ } else {

}
if ((isEmpty(obj)) && stack.length > 0) {
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : '';
if (isEmpty(obj)) {
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : emptyStr;
}

@@ -188,3 +187,4 @@ if (_this.options.validator != null) {

obj = _this.options.validator(xpath, s && s[nodeName], obj);
} catch (err) {
} catch (_error) {
err = _error;
_this.emit("error", err);

@@ -235,9 +235,18 @@ }

};
return this.saxParser.ontext = this.saxParser.oncdata = function(text) {
ontext = function(text) {
var s;
s = stack[stack.length - 1];
if (s) {
return s[charkey] += text;
s[charkey] += text;
return s;
}
};
this.saxParser.ontext = ontext;
return this.saxParser.oncdata = function(text) {
var s;
s = ontext(text);
if (s) {
return s.cdata = true;
}
};
};

@@ -244,0 +253,0 @@

@@ -6,3 +6,3 @@ {

"homepage" : "https://github.com/Leonidas-from-XIV/node-xml2js",
"version" : "0.2.7",
"version" : "0.2.8",
"author" : "Marek Kubica <marek@xivilization.net> (http://xivilization.net)",

@@ -26,3 +26,4 @@ "contributors" : [

"Mikhail Zyatin <mikhail.zyatin@gmail.com> (https://github.com/Sitin)",
"Chris Tavares <ctavares@microsoft.com> (https://github.com/christav)"
"Chris Tavares <ctavares@microsoft.com> (https://github.com/christav)",
"Frank Xu <yyfrankyy@gmail.com> (http://f2e.us/)"
],

@@ -41,6 +42,6 @@ "main" : "./lib/xml2js",

"dependencies" : {
"sax" : "0.5.2"
"sax" : "0.5.x"
},
"devDependencies" : {
"coffee-script" : ">=1.6.1",
"coffee-script" : ">=1.6.3",
"zap" : ">=0.2.5",

@@ -47,0 +48,0 @@ "docco" : ">=0.6.2"

@@ -97,2 +97,8 @@ node-xml2js

But what happens if you forget the `new` keyword to create a new `Parser`? In
the middle of a nightly coding session, it might get lost, after all. Worry
not, we got you covered! Starting with 0.2.8 you can also leave it out, in
which case `xml2js` will helpfully add it for you, no bad surprises and
inexplicable bugs!
"Traditional" usage

@@ -99,0 +105,0 @@ -------------------

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