Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

he

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

he

A robust HTML entities encoder/decoder with full Unicode support.

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23M
increased by13.87%
Maintainers
1
Weekly downloads
 
Created

What is he?

The 'he' npm package is a robust HTML entity encoder/decoder written in JavaScript. It supports all standardized named character references, numeric character references, and it can encode/decode any arbitrary data in UTF-8 encoding. It is designed to work in all modern web browsers and can be used with Node.js.

What are he's main functionalities?

Encode HTML entities

This feature allows you to encode text into HTML entities, which is useful for preventing XSS attacks by sanitizing user input before inserting it into the DOM.

const he = require('he');
const encoded = he.encode('Schrödinger’s cat & Co.');
console.log(encoded); // 'Schrödinger’s cat & Co.'

Decode HTML entities

This feature allows you to decode HTML entities back into their original form, which is useful for displaying encoded content as plain text.

const he = require('he');
const decoded = he.decode('Schrödinger’s cat & Co.');
console.log(decoded); // 'Schrödinger’s cat & Co.'

Escape XML entities

This feature allows you to escape XML entities, which is similar to encoding but specifically for XML content.

const he = require('he');
const escaped = he.escape('Schrödinger’s cat & Co.');
console.log(escaped); // 'Schrödinger’s cat & Co.'

Unescape XML entities

This feature allows you to unescape XML entities, which is the reverse process of escaping and is used to convert XML-encoded content back to its original form.

const he = require('he');
const unescaped = he.unescape('Schrödinger’s cat & Co.');
console.log(unescaped); // 'Schrödinger’s cat & Co.'

Other packages similar to he

Keywords

FAQs

Package last updated on 28 Jun 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc