JSPM

  • Created
  • Published
  • Downloads 99502113
  • Score
    100M100P100Q261944F
  • License BSD-like

Encode & decode XML/HTML entities with ease

Package Exports

  • entities

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 (entities) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#entities

En- & decoder for XML/HTML entities.

####Features:

  • Focussed on speed
  • Supports three levels of entities: XML, HTML4 & HTML5
    • Supports char code entities (eg. U)

##How to…

###…install entities

npm i entities

###…use entities

//encoding
require("entities").encode(<str> data[, <int> level]);
//decoding
require("entities").decode(<str> data[, <int> level]);

The level attribute indicates what level of entities should be decoded (0 = XML, 1 = HTML4 and 2 = HTML5). The default is 0 (read: XML).

There are also methods to access the level directly. Just append the name of the level to the action and you're ready to go (e.g. encodeHTML4(data), decodeXML(data)).