Comparing version 0.2.1 to 0.2.2
@@ -17,3 +17,3 @@ var toXML = function(obj, config){ | ||
} | ||
return txt.replace(new RegExp('(' + replacements.join('|') + ')', 'g'), function(str, entity) { | ||
return String(txt).replace(new RegExp('(' + replacements.join('|') + ')', 'g'), function(str, entity) { | ||
return mappings[entity] || ''; | ||
@@ -20,0 +20,0 @@ }); |
{ | ||
"name": "jstoxml", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Convert JSON to XML (for RSS, Podcasts, etc.)", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/davidcalhoun/jstoxml", |
@@ -13,3 +13,3 @@ jstoxml | ||
* tabbed output (optional) | ||
* custom filters (& -> &, etc) (optional) | ||
* custom filters (<code>&</code> -> <code>&</code>, etc) (optional) | ||
@@ -16,0 +16,0 @@ ### Installation |
26
test.js
@@ -536,2 +536,28 @@ var jstoxml = require('./jstoxml.js'); | ||
}); | ||
addTest({ | ||
name: 'bug4a', | ||
input: function(){ | ||
return jstoxml.toXML({ | ||
foo: 4, | ||
bar: '&' | ||
}); | ||
}, | ||
expectedOutput: '<foo>4</foo><bar>&</bar>' | ||
}); | ||
addTest({ | ||
name: 'bug4b', | ||
input: function(){ | ||
return jstoxml.toXML({ | ||
foo: '&' | ||
}, | ||
{ | ||
filter: { | ||
'&': '&' | ||
} | ||
}); | ||
}, | ||
expectedOutput: '<foo>&</foo>' | ||
}); | ||
@@ -538,0 +564,0 @@ runTests(); |
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
33032
685