Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura
Christian Matos 27f21d784d ios quick fix 4 лет назад
..
.npmignore IOS 4 лет назад
LICENSE IOS 4 лет назад
README.md IOS 4 лет назад
index.js IOS 4 лет назад
package.json ios quick fix 4 лет назад
test.js IOS 4 лет назад

README.md

xml-escape

Escape XML in javascript (NodeJS)

npm install xml-escape

// Warning escape is a reserved word, so maybe best to use xmlescape for var name
var xmlescape = require('xml-escape');

xmlescape('"hello" \'world\' & false < true > -1');

// output
// '&quot;hello&quot; &apos;world&apos; &amp; false &lt; true &gt; -1'

// don't escape some characters
xmlescape('"hello" \'world\' & false < true > -1', '>"&')

// output
// '"hello" &apos;world&apos; & false &lt; true > -1'

There is also now an ignore function thanks to @jayflo

esc = require('./');

ignore = '"<&'
// note you should never ignore an &
output = esc('I am "<&not>" escaped', ignore)
console.log(output)

//I am "<&not&gt;" escaped

Bitdeli Badge