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.6.0 to 0.6.1

lib/xml2js.bc.js

41

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

@@ -25,6 +25,2 @@ 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) {

@@ -39,2 +35,12 @@ var i, len, process;

defineProperty = function(obj, key, value) {
var descriptor;
descriptor = Object.create(null);
descriptor.value = value;
descriptor.writeable = true;
descriptor.enumerable = true;
descriptor.configurable = true;
return Object.defineProperty(obj, key, descriptor);
};
exports.Parser = (function(superClass) {

@@ -101,14 +107,11 @@ extend(Parser, superClass);

Parser.prototype.assignOrPush = function(obj, key, newValue) {
if (!isValidKey(key)) {
return;
}
if (!(key in obj)) {
if (!this.options.explicitArray) {
return obj[key] = newValue;
return defineProperty(obj, key, newValue);
} else {
return obj[key] = [newValue];
return defineProperty(obj, key, [newValue]);
}
} else {
if (!(obj[key] instanceof Array)) {
obj[key] = [obj[key]];
defineProperty(obj, key, [obj[key]]);
}

@@ -165,8 +168,6 @@ return obj[key].push(newValue);

processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
if (isValidKey(processedKey)) {
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
}
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
defineProperty(obj[attrkey], processedKey, newValue);
}

@@ -260,5 +261,3 @@ }

if (!hasProp.call(obj, key)) continue;
if (isValidKey(key)) {
objClone[key] = obj[key];
}
defineProperty(objClone, key, obj[key]);
}

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

obj = {};
obj[nodeName] = old;
defineProperty(obj, nodeName, old);
}

@@ -281,0 +280,0 @@ _this.resultObject = obj;

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

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

@@ -12,0 +12,0 @@ "contributors": [

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