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

stringify-entities

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stringify-entities

Encode HTML character references and character entities

  • 1.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9M
decreased by-13.02%
Maintainers
1
Weekly downloads
 
Created

What is stringify-entities?

The stringify-entities npm package is used for encoding special characters into HTML or XML entities. It is particularly useful when you need to ensure that text content is safely and correctly represented in HTML or XML documents, preventing issues related to unescaped characters.

What are stringify-entities's main functionalities?

Encode special characters in HTML

This feature allows you to convert characters that have special meaning in HTML into their corresponding HTML entities, thus preventing them from being interpreted as HTML code. This is useful for displaying plain text in web pages.

const stringify = require('stringify-entities');

const text = 'This & that';
const encodedText = stringify(text);
console.log(encodedText); // 'This & that'

Encode special characters in XML

This feature enables the encoding of characters into XML entities. By specifying options, you can control which characters to encode and whether to escape only those characters, making it flexible for different XML contexts.

const stringify = require('stringify-entities');

const text = 'AT&T';
const options = {subset: ['&'], escapeOnly: true};
const encodedText = stringify(text, options);
console.log(encodedText); // 'AT&T'

Other packages similar to stringify-entities

Keywords

FAQs

Package last updated on 29 Apr 2018

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