🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-html-encoder

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-html-encoder

Package for encoding and decoding html string

0.0.2
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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"

Keywords

encoder

FAQs

Package last updated on 08 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts