xml-sanitizer
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -7,5 +7,5 @@ // A list of invalid XML characters can be found at https://www.w3.org/TR/2000/REC-xml-20001006#NT-Char | ||
function xmlSanitizer(string, replacement) { | ||
return stripAnsi(string.replace(/[\u0000-\u0008]|\u000B|\u000C|[\u000E-\u001F]|[\u007f-\u0084]|[\u0086-\u009f]|[\uD800-\uDFFF]|[\uFDD0-\uFDFF]|\uFFFF|\uC008/, replacement || '')); | ||
return stripAnsi(string.replace(/[\u0000-\u0008]|\u000B|\u000C|[\u000E-\u001F]|[\u007f-\u0084]|[\u0086-\u009f]|[\uD800-\uDFFF]|[\uFDD0-\uFDFF]|\uFFFF|\uC008/g, replacement || '')); | ||
} | ||
module.exports = xmlSanitizer; |
{ | ||
"name": "xml-sanitizer", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Sanitize out invalid xml characters from your strings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -88,2 +88,9 @@ 'use strict'; | ||
test('Multiple Characters', function (t) { | ||
invalidCharacters.forEach(function(char) { | ||
t.equals(xmlSanitizer(char + '\u0000\u0000'), '', 'it should return an empty string'); | ||
}); | ||
t.end(); | ||
}); | ||
test('Replace Characters', function (t) { | ||
@@ -90,0 +97,0 @@ invalidCharacters.forEach(function(char) { |
4970
106