NodeJS wrapper for JavaScript HTML Encoder library http://www.strictly-software.com/htmlencode
Clone or download
Pavel Minchenkov
Pavel Minchenkov version number updated
Latest commit 95ed4b3 Feb 8, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib keep htmlEncode and htmlDecode from converting blank strings into emp… Feb 8, 2013
.gitignore Encoder added Sep 13, 2011
README.md small changes to readme.md and comments Sep 13, 2011
package.json version number updated Feb 8, 2013

README.md

node-html-encoder

NodeJS wrapper for JavaScript HTML Encoder library http://www.strictly-software.com/htmlencode

Install

npm install node-html-encoder

Examples

var Encoder = require('node-html-encoder').Encoder;

// entity type encoder
var encoder = new Encoder('entity');

console.log(encoder.htmlEncode('<foo /> "bar"'))
// prints &lt;foo /&gt; &quot;bar&quot;

console.log(encoder.htmlDecode('&lt;foo /&gt; &quot;bar&quot;'))
// prints <foo /> "bar"

// numerical type encoder
encoder = new Encoder('numerical');

console.log(encoder.htmlEncode('<foo /> "bar"'))
// prints &#60;foo /&#62; &#34;bar&#34;

console.log(encoder.htmlDecode('&#60;foo /&#62; &#34;bar&#34;'))
// prints <foo /> "bar"