find-node-modules
Version:
Return an array of all parent node_modules directories
19 lines (15 loc) • 358 B
JavaScript
var XML_CHARACTER_MAP = {
'&': '&',
'"': '"',
"'": ''',
'<': '<',
'>': '>'
};
function escapeForXML(string) {
return string && string.replace
? string.replace(/([&"<>'])/g, function(str, item) {
return XML_CHARACTER_MAP[item];
})
: string;
}
module.exports = escapeForXML;