jstransformer-cdata-js
v1.0.0
Published
JSTransformer that transforms a JavaScript string into XML CDATA.
Downloads
235
Readme
jstransformer-cdata-js
Transformer that converts a JavaScript string to an XML CDATA.
Installation
npm install jstransformer-cdata-js
API
var cdata = require('jstransformer')(require('jstransformer-cdata-js'))
cdata.render('"hello world"').body
// <![CDATA[
// "hello world"
// //]]>
// ']]>' is properly escaped:
cdata.render('var str = "<[[goodbye world]]>"').body
// <![CDATA[
// var str = "<[[goodbye world]]]]><![CDATA[>"
// //]]>
License
MIT