xmlbuilder
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -7,5 +7,5 @@ // Generated by CoffeeScript 1.3.3 | ||
module.exports.create = function(name, xmldec, doctype) { | ||
module.exports.create = function(name, xmldec, doctype, options) { | ||
if (name != null) { | ||
return new XMLBuilder(name, xmldec, doctype).root(); | ||
return new XMLBuilder(name, xmldec, doctype, options).root(); | ||
} else { | ||
@@ -12,0 +12,0 @@ return new XMLBuilder(); |
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
var XMLBuilder, XMLFragment; | ||
var XMLBuilder, XMLFragment, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | ||
@@ -9,3 +10,5 @@ XMLFragment = require('./XMLFragment'); | ||
function XMLBuilder(name, xmldec, doctype) { | ||
function XMLBuilder(name, xmldec, doctype, options) { | ||
this.assertLegalChar = __bind(this.assertLegalChar, this); | ||
var att, child, _ref; | ||
@@ -26,2 +29,3 @@ this.children = []; | ||
} | ||
this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0; | ||
if ((xmldec != null) && !(xmldec.version != null)) { | ||
@@ -115,2 +119,15 @@ throw new Error("Version number is required"); | ||
XMLBuilder.prototype.assertLegalChar = function(str) { | ||
var chars, chr; | ||
if (this.allowSurrogateChars) { | ||
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/; | ||
} else { | ||
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/; | ||
} | ||
chr = str.match(chars); | ||
if (chr) { | ||
throw new Error("Invalid character (" + chr + ") in string: " + str + " at index " + chr.index); | ||
} | ||
}; | ||
return XMLBuilder; | ||
@@ -117,0 +134,0 @@ |
@@ -16,2 +16,3 @@ // Generated by CoffeeScript 1.3.3 | ||
this.children = []; | ||
this.assertLegalChar = parent.assertLegalChar; | ||
} | ||
@@ -306,2 +307,3 @@ | ||
for (attName in _ref) { | ||
if (!__hasProp.call(_ref, attName)) continue; | ||
attValue = _ref[attName]; | ||
@@ -321,3 +323,3 @@ if (this.name === '!DOCTYPE') { | ||
} | ||
} else if (pretty && this.children.length === 1 && this.children[0].value) { | ||
} else if (pretty && this.children.length === 1 && (this.children[0].value != null)) { | ||
r += '>'; | ||
@@ -352,11 +354,2 @@ r += this.children[0].value; | ||
XMLFragment.prototype.assertLegalChar = function(str) { | ||
var chars, chr; | ||
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/; | ||
chr = str.match(chars); | ||
if (chr) { | ||
throw new Error("Invalid character (" + chr + ") in string: " + str); | ||
} | ||
}; | ||
XMLFragment.prototype.is = function(obj, type) { | ||
@@ -363,0 +356,0 @@ var clas; |
{ | ||
"name": "xmlbuilder", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"keywords": [ "xml", "xmlbuilder" ], | ||
@@ -11,4 +11,4 @@ "homepage": "http://github.com/oozcitak/xmlbuilder-js", | ||
"type": "MIT", | ||
"url": "http://opensource.org/licenses/mit-license.php" | ||
} | ||
"url": "http://opensource.org/licenses/mit-license.php" | ||
} | ||
], | ||
@@ -23,4 +23,4 @@ "repository": { | ||
"main": "./lib/index", | ||
"engines": { | ||
"node": ">=0.2.0" | ||
"engines": { | ||
"node": ">=0.2.0" | ||
}, | ||
@@ -31,5 +31,7 @@ "devDependencies": { | ||
"scripts": { | ||
"prepublish": "make release", | ||
"postpublish": "make clean", | ||
"test": "make test" | ||
} | ||
} | ||
Sorry, the diff of this file is not supported yet
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
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
19294
7
509