source: node_modules/xml/lib/escapeForXML.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 358 bytes
Line 
1
2var XML_CHARACTER_MAP = {
3 '&': '&amp;',
4 '"': '&quot;',
5 "'": '&apos;',
6 '<': '&lt;',
7 '>': '&gt;'
8};
9
10function escapeForXML(string) {
11 return string && string.replace
12 ? string.replace(/([&"<>'])/g, function(str, item) {
13 return XML_CHARACTER_MAP[item];
14 })
15 : string;
16}
17
18module.exports = escapeForXML;
Note: See TracBrowser for help on using the repository browser.