Socket
Socket
Sign inDemoInstall

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.5.0 to 0.6.0

33

lib/parser.js
// Generated by CoffeeScript 1.12.7
(function() {
"use strict";
var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
var bom, defaults, events, isEmpty, isValidKey, processItem, processors, sax, setImmediate,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -25,2 +25,6 @@ extend = 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; },

isValidKey = function(key) {
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
};
processItem = function(processors, item, key) {

@@ -96,2 +100,5 @@ var i, len, process;

Parser.prototype.assignOrPush = function(obj, key, newValue) {
if (!isValidKey(key)) {
return;
}
if (!(key in obj)) {

@@ -146,3 +153,3 @@ if (!this.options.explicitArray) {

var key, newValue, obj, processedKey, ref;
obj = Object.create(null);
obj = {};
obj[charkey] = "";

@@ -154,10 +161,12 @@ if (!_this.options.ignoreAttrs) {

if (!(attrkey in obj) && !_this.options.mergeAttrs) {
obj[attrkey] = Object.create(null);
obj[attrkey] = {};
}
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
if (isValidKey(processedKey)) {
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
}
}

@@ -233,3 +242,3 @@ }

if (!_this.options.preserveChildrenOrder) {
node = Object.create(null);
node = {};
if (_this.options.attrkey in obj) {

@@ -249,6 +258,8 @@ node[_this.options.attrkey] = obj[_this.options.attrkey];

s[_this.options.childkey] = s[_this.options.childkey] || [];
objClone = Object.create(null);
objClone = {};
for (key in obj) {
if (!hasProp.call(obj, key)) continue;
objClone[key] = obj[key];
if (isValidKey(key)) {
objClone[key] = obj[key];
}
}

@@ -267,3 +278,3 @@ s[_this.options.childkey].push(objClone);

old = obj;
obj = Object.create(null);
obj = {};
obj[nodeName] = old;

@@ -270,0 +281,0 @@ }

@@ -9,3 +9,3 @@ {

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

@@ -83,3 +83,3 @@ "contributors": [

"devDependencies": {
"coffee-script": ">=1.10.0",
"coffeescript": ">=1.10.0 <2",
"coveralls": "^3.0.1",

@@ -89,3 +89,3 @@ "diff": ">=1.0.8",

"nyc": ">=2.2.1",
"zap": ">=0.2.9"
"zap": ">=0.2.9 <1"
},

@@ -92,0 +92,0 @@ "engines": {

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