node-html-encoder
Version:
Package for encoding and decoding html string
29 lines (18 loc) • 764 B
Markdown
# 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 <foo /> "bar"
console.log(encoder.htmlDecode('<foo /> "bar"'))
// prints <foo /> "bar"
// numerical type encoder
encoder = new Encoder('numerical');
console.log(encoder.htmlEncode('<foo /> "bar"'))
// prints <foo /> "bar"
console.log(encoder.htmlDecode('<foo /> "bar"'))
// prints <foo /> "bar"