Comparing version 0.6.0 to 0.6.1
// 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": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3436189
10
38690
1