simple-entity-decode

0.0.3 • Public • Published

Simple Entity Decode

npm npm bundle size

A tiny library to decode HTML numeric entities and basic XML named entities.

Most entity libraries include complex handling for entities, and include the full list of named entities from the HTML specification. However, most applications and pages don't need this, and can instead normalise entities (e.g. on the server).

Specifically, this library decodes:

  • Basic named entities (&, ', ", <, >)
  • Numeric decimal entities (£)
  • Numeric hexadecimal entities (£)

It does not handle other named entities. Instead, normalise the entities on the server; for example in WordPress, you can use the ent2ncr function.

Usage

import decodeEntities from 'simple-entity-decode';
 
decodeEntities( 'Bill & Ted’s Excellent Adventure' );
// → "Bill & Ted’s Excellent Adventure"

Licence

Copyright 2019 Human Made. Licensed under the MIT license.

Uses code from he by Mathias Bynens. Used under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i simple-entity-decode

Weekly Downloads

241

Version

0.0.3

License

MIT

Unpacked Size

6.82 kB

Total Files

8

Last publish

Collaborators

  • rmccue