hecon

1.0.0 • Public • Published

HTML Entity Converter

⚙️ Installation

npm i hecon

CDN Links:

📘 Documentation

⇒ Import hecon

ES6

import hecon from 'hecon';

commonjs

const hecon = require('hecon');

⇒ Encode string to HTML entity

console.log(hecon.encode('< Hello />'));

output:

&#60;&#32;&#72;&#101;&#108;&#108;&#111;&#32;&#47;&#62;

⇒ Encode string to HTML entity (Type - 2)

console.log(hecon.encode('< Hello />', true));

output:

&#60; Hello &#47;&#62;

⇒ Decode HTML entity from string

console.log(hecon.decode('&#60; Hello &#47;&#62;'));
console.log(hecon.decode('&#60;&#32;&#72;&#101;&#108;&#108;&#111;&#32;&#47;&#62;'));

output:

< Hello />

Support me on Patreon - Check out my socials

Package Sidebar

Install

npm i hecon

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.56 kB

Total Files

4

Last publish

Collaborators

  • axoraxdev