This package has been deprecated

Author message:

Moved to @favware/unescape. Please migrate for future updates

unescape-es6
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Unescape

Unescape-es6

Convert HTML entities to HTML characters, e.g. > converts to >.

DepfuLicenseBuild Status

NPM bundle size (minified)NPM bundle size (minified + gzip)NPM VersionNPM Weekly DownloadsNPM Total Downloads

Follow me on TwitterDonate with PayPalBecome a Patron

Join Discord Server
NPM Stats


Based on unescape from jonschlinkert but updated for ES6

Install

Install with yarn:

$ yarn add unescape

Usage

const { unescape } = require('unescape-es6');
// or for TypeScript:
// import { unescape } from 'unescape-es6';
 
console.log(unescape('<div>abc</div>'));
//=> '<div>abc</div>'
 
// use template tags
console.log(unescape`&lt;div&gt;abc&lt;/div&gt;`); // => '<div>abc</div>'
 
// or with variables
const unescaped = '&lt;div&gt;unescaped&lt;/div&gt;';
console.log(unescape`awesome text with some ${unescaped} section`); //=> 'awesome text with some <div>unescaped</div> section' 

Characters

For performance, this library only handles the following common entities

Only the following entities are converted by default.

Character Description Entity Name Entity Decimal Entity Hex
" double quotation mark &quot; &#34; &#x22;
' single quotation mark (apostrophe) &apos; &#39; &#x27;
& ampersand &amp; &#38; &#x26;
> greater than &gt; &#62; &#x3e;
< less than &lt; &#60; &#x3c;
Single regular space &nbsp; N.A &#xa0;
© copyright &copy; &#169; &#xa9;
¢ cent &cent; &#162; &#xa2;
® registered trademark &reg; &#174; &#xae;
euro &euro; &#8364; N.A.
£ pound &pound; &#163; &#xa3;
¥ yen &yen; &#165; &#xa5;

You can also print characters in runtime:

const { charSets } = require('unescape-es6');
 
console.log(charSets);

About

Alternatives

If you need a more robust implementation, try one of the following libraries:

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

License

Copyright © 2018-2019, Favna. Released under the MIT License.

Buy me a donut

This project is open source and always will be, even if I don't get donations. That said, I know there are people out there that may still want to donate just to show their appreciation so this is for you guys. Thanks in advance!

I accept donations through PayPal, BitCoin, Ethereum and LiteCoin. You can use the buttons below to donate through your method of choice

Donate With QR Address
Donate with PayPal
1E643TNif2MTh75rugepmXuq35Tck4TnE5
0xF653F666903cd8739030D2721bF01095896F5D6E
LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6

Package Sidebar

Install

npm i unescape-es6

Weekly Downloads

10

Version

2.1.2

License

MIT

Unpacked Size

12.9 kB

Total Files

12

Last publish

Collaborators

  • favna