JSPM

  • Created
  • Published
  • Downloads 24495403
  • Score
    100M100P100Q274152F
  • License MIT

Faster HTML entities encode/decode library.

Package Exports

  • html-entities
  • html-entities/lib/xml-entities
  • html-entities/lib/xml-entities.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-entities) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-html-entities

Faster html entities library.

Installation

npm install html-entities

Usage

####Basic HTML entities####

HTML validity and XSS attack prevention you can achieve from XmlEntities class.

var Entities = require('html-entities').XmlEntities;

entities = new Entities();

console.log(entities.encode('<>"&©®')); // &lt;&gt;&quot;&amp;©®
console.log(entities.decode('&lt;&gt;&quot;&amp;&copy;&reg;')); // <>"&

####All HTML entities encoding/decoding####

var Entities = require('html-entities').AllHtmlEntities;

entities = new Entities();

console.log(entities.encode('<>"&©®')); // &lt;&gt;&quot;&amp;&copy;&reg;
console.log(entities.decode('&lt;&gt;&quot;&amp;&copy;&reg;')); // <>"&©®

####Available classes####

var XmlEntities = require('html-entities').XmlEntities, // <>"'& + &#...; decoding
    Html4Entities = require('html-entities').Html4Entities, // HTML4 entities.
    Html5Entities = require('html-entities').Html4Entities, // HTML5 entities.
    AllHtmlEntities = require('html-entities').AllHtmlEntities, // Synonym for HTML5 entities.