UNPKG
drachtio-modesl
Version:
latest (2.0.1)
2.0.1
1.3.1
1.2.10
1.2.9
1.2.7
1.2.6
1.2.5
1.2.4
1.2.2
1.2.1
1.2.0
FreeSWITCH ESL Node.js Implementation
github.com/davehorton/node-esl
davehorton/node-esl
drachtio-modesl
/
lib
/
util
/
xml.js
16 lines
(13 loc)
•
287 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const
XML_ESCAPE_MAP
= {
'>'
:
'>'
,
'<'
:
'<'
,
'\''
:
'''
,
'"'
:
'"'
,
'&'
:
'&'
};
module
.
exports
= {
encodeXml
(
string
) {
if
(!
string
)
return
''
;
return
string
.
replace
(
/([&"<>\'])/g
,
(
str, item
) =>
XML_ESCAPE_MAP
[item]); } };