simple-entity-decode
v0.0.3
Published
[![npm](https://img.shields.io/npm/v/simple-entity-decode)](https://www.npmjs.com/package/simple-entity-decode) [![npm bundle size](https://img.shields.io/bundlephobia/min/simple-entity-decode)](https://bundlephobia.com/result?p=simple-entity-decode)
Downloads
1,418
Readme
Simple Entity Decode
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.