Socket
Socket
Sign inDemoInstall

xmlbuilder

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmlbuilder - npm Package Compare versions

Comparing version 4.2.1 to 5.0.0

29

lib/XMLElement.js

@@ -136,3 +136,3 @@ // Generated by CoffeeScript 1.9.1

XMLElement.prototype.toString = function(options, level) {
var att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, space;
var allowEmpty, att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, ref6, space;
pretty = (options != null ? options.pretty : void 0) || false;

@@ -142,8 +142,9 @@ indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';

newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
allowEmpty = (ref3 = options != null ? options.allowEmpty : void 0) != null ? ref3 : false;
level || (level = 0);
space = new Array(level + offset + 1).join(indent);
r = '';
ref3 = this.instructions;
for (i = 0, len = ref3.length; i < len; i++) {
instruction = ref3[i];
ref4 = this.instructions;
for (i = 0, len = ref4.length; i < len; i++) {
instruction = ref4[i];
r += instruction.toString(options, level);

@@ -155,6 +156,6 @@ }

r += '<' + this.name;
ref4 = this.attributes;
for (name in ref4) {
if (!hasProp.call(ref4, name)) continue;
att = ref4[name];
ref5 = this.attributes;
for (name in ref5) {
if (!hasProp.call(ref5, name)) continue;
att = ref5[name];
r += att.toString(options);

@@ -165,3 +166,7 @@ }

})) {
r += '/>';
if (allowEmpty) {
r += '></' + this.name + '>';
} else {
r += '/>';
}
if (pretty) {

@@ -180,5 +185,5 @@ r += newline;

}
ref5 = this.children;
for (j = 0, len1 = ref5.length; j < len1; j++) {
child = ref5[j];
ref6 = this.children;
for (j = 0, len1 = ref6.length; j < len1; j++) {
child = ref6[j];
r += child.toString(options, level + 1);

@@ -185,0 +190,0 @@ }

@@ -13,2 +13,3 @@ // Generated by CoffeeScript 1.9.1

this.noDoubleEncoding = options != null ? options.noDoubleEncoding : void 0;
this.textCase = options != null ? options.textCase : void 0;
ref = (options != null ? options.stringify : void 0) || {};

@@ -24,2 +25,3 @@ for (key in ref) {

val = '' + val || '';
val = this.applyCase(val);
return this.assertLegalChar(val);

@@ -35,5 +37,3 @@ };

val = '' + val || '';
if (val.match(/]]>/)) {
throw new Error("Invalid CDATA text: " + val);
}
val = val.replace(']]>', ']]]]><![CDATA[>');
return this.assertLegalChar(val);

@@ -55,3 +55,4 @@ };

XMLStringifier.prototype.attName = function(val) {
return '' + val || '';
val = '' + val || '';
return val = this.applyCase(val);
};

@@ -158,2 +159,18 @@

XMLStringifier.prototype.applyCase = function(str) {
switch (this.textCase) {
case "camel":
return require('lodash/camelCase')(str);
case "kebab":
case "lower":
return require('lodash/kebabCase')(str);
case "snake":
return require('lodash/snakeCase')(str);
case "upper":
return require('lodash/kebabCase')(str).toUpperCase();
default:
return str;
}
};
XMLStringifier.prototype.elEscape = function(str) {

@@ -168,3 +185,3 @@ var ampregex;

ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');
};

@@ -171,0 +188,0 @@

{
"name": "xmlbuilder",
"version": "4.2.1",
"version": "5.0.0",
"keywords": [

@@ -22,3 +22,3 @@ "xml",

"engines": {
"node": ">=0.8.0"
"node": ">=0.10"
},

@@ -25,0 +25,0 @@ "dependencies": {

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