Socket
Socket
Sign inDemoInstall

ent

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ent

Encode and decode HTML entities


Version published
Weekly downloads
5.6M
increased by0.8%
Maintainers
1
Install size
11.9 kB
Created
Weekly downloads
 

Package description

What is ent?

The 'ent' npm package is used for encoding and decoding HTML entities. It provides a simple way to convert special characters to their corresponding HTML entities and vice versa.

What are ent's main functionalities?

Encoding HTML Entities

This feature allows you to encode special characters in a string to their corresponding HTML entities. This is useful for safely displaying user-generated content on a web page.

const ent = require('ent');
const encoded = ent.encode('<div>Hello & welcome!</div>');
console.log(encoded); // Output: &lt;div&gt;Hello &amp; welcome!&lt;/div&gt;

Decoding HTML Entities

This feature allows you to decode HTML entities back to their original characters. This is useful for processing HTML content that has been encoded.

const ent = require('ent');
const decoded = ent.decode('&lt;div&gt;Hello &amp; welcome!&lt;/div&gt;');
console.log(decoded); // Output: <div>Hello & welcome!</div>

Other packages similar to ent

Changelog

Source

v0.0.7 - 2013-07-29

Fixed

  • Fix astral symbols [closes #7] #7

Commits

  • Add test for astral symbols [see #7] 4e59dc3

Readme

Source

ent

Encode and decode HTML entities

browser support

build status

example

var ent = require('ent');
console.log(ent.encode('<span>©moo</span>'))
console.log(ent.decode('&pi; &amp; &rho;'));
&lt;span&gt;&copy;moo&lt;/span&gt;
π & ρ

ent

methods

encode(str)

Escape unsafe characters in str with html entities.

decode(str)

Convert html entities in str back to raw text.

credits

HTML entity tables shamelessly lifted from perl's HTML::Entities

install

With npm do:

npm install ent

license

MIT

Keywords

FAQs

Last updated on 29 Jul 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc