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 namevar xmlescape = ; ; // output// '"hello" 'world' & false < true > -1' // don't escape some characters // output// '"hello" 'world' & false < true > -1'
There is also now an ignore function thanks to @jayflo
esc = ; ignore = '"<&'// note you should never ignore an &output = console //I am "<¬>" escaped