Socket
Socket
Sign inDemoInstall

xmlbuilder

Package Overview
Dependencies
Maintainers
0
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 0.1.1 to 0.1.2

31

lib/XMLFragment.js

@@ -12,4 +12,4 @@ (function() {

}
XMLFragment.prototype.element = function(name, attributes) {
var child, key, val;
XMLFragment.prototype.element = function(name, attributes, text) {
var child, key, val, _ref, _ref2;
if (!(name != null)) {

@@ -21,2 +21,7 @@ throw new Error("Missing element name");

attributes != null ? attributes : attributes = {};
if (this.is(attributes, 'String') && this.is(text, 'Object')) {
_ref = [text, attributes], attributes = _ref[0], text = _ref[1];
} else if (this.is(attributes, 'String')) {
_ref2 = [{}, attribues], attributes = _ref2[0], text = _ref2[1];
}
for (key in attributes) {

@@ -29,2 +34,8 @@ if (!__hasProp.call(attributes, key)) continue;

child = new XMLFragment(this, name, attributes);
if (text != null) {
text = '' + text || '';
text = this.escape(text);
this.assertLegalChar(text);
child.text(text);
}
this.children.push(child);

@@ -101,5 +112,2 @@ return child;

(_ref = this.attributes) != null ? _ref : this.attributes = {};
if (this.attributes.hasOwnProperty(name)) {
throw new Error("Attribute already defined: " + name);
}
this.attributes[name] = this.escape(value);

@@ -171,5 +179,10 @@ return this;

};
XMLFragment.prototype.ele = function(name, attributes) {
return this.element(name, attributes);
XMLFragment.prototype.is = function(obj, type) {
var clas;
clas = Object.prototype.toString.call(obj).slice(8, -1);
return (obj != null) && clas === type;
};
XMLFragment.prototype.ele = function(name, attributes, text) {
return this.element(name, attributes, text);
};
XMLFragment.prototype.txt = function(value) {

@@ -187,4 +200,4 @@ return this.text(value);

};
XMLFragment.prototype.e = function(name, attributes) {
return this.element(name, attributes);
XMLFragment.prototype.e = function(name, attributes, text) {
return this.element(name, attributes, text);
};

@@ -191,0 +204,0 @@ XMLFragment.prototype.t = function(value) {

{
"name" : "xmlbuilder",
"version": "0.1.1",
"version": "0.1.2",
"description": "An XML builder for node.js",

@@ -5,0 +5,0 @@ "author": "Ozgur Ozcitak <oozcitak@gmail.com>",

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