npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

html-entities-list

v1.0.2

Published

[DEPRECATED] A complete, typed dataset of common HTML entities with utilities for encoding/decoding.

Readme

⚠️ DEPRECATED

This package is no longer maintained.

Please use html-entities instead. See: https://www.npmjs.com/package/html-entities


Original README below:


html-entities-list

npm version License: MIT

(https://codecov.io/gh/venkatajanapareddy/html-entities-list) TypeScript

A complete, typed dataset of common HTML entities with utilities for encoding and decoding. This library provides a comprehensive list of HTML named entities along with robust functions for encoding text to HTML entities and decoding HTML entities from text.

Features

  • 📚 Complete dataset of common HTML named entities
  • 🔒 Zero runtime dependencies
  • 📝 Strong TypeScript support with full type definitions
  • 🛠️ Utility functions for encoding and decoding
  • 🧪 Thoroughly tested with high coverage
  • 📦 Dual module support (ESM and CommonJS)
  • 🌳 Tree-shakable

Installation

npm install html-entities-list

Usage

Basic Usage

import { encodeHtmlEntities, decodeHtmlEntities } from 'html-entities-list';

// Encoding
encodeHtmlEntities('Hello & World'); // 'Hello & World'
encodeHtmlEntities('<script>'); // '&lt;script&gt;'

// Decoding
decodeHtmlEntities('Hello &amp; World'); // 'Hello & World'
decodeHtmlEntities('&lt;script&gt;'); // '<script>'

Working with Entity Data

import { htmlEntities, getEntityByName, getCharacterByEntityName } from 'html-entities-list';

// Get all entities
console.log(htmlEntities); // Array of all HTML entities

// Get entity by name
const entity = getEntityByName('&copy;');
console.log(entity);
// {
//   name: '&copy;',
//   character: '©',
//   description: 'Copyright sign',
//   numericDecimal: 169,
//   numericHex: 'A9'
// }

// Get character by entity name
const character = getCharacterByEntityName('&gt;');
console.log(character); // '>'

Advanced Encoding Options

import { encodeHtmlEntities } from 'html-entities-list';

// Encode specific characters only
encodeHtmlEntities('<>&"\'', { subset: ['<', '>'] }); // '&lt;&gt;&"\''

// Encode non-ASCII characters
encodeHtmlEntities('Hello © World', { encodeNonAscii: true }); // 'Hello &#169; World'

API Reference

Data Exports

  • htmlEntities: Readonly<HtmlEntity[]> - Array of all HTML entities
  • htmlEntityMapByName: Readonly<Record<HtmlEntityName, HtmlEntity>> - Map of entities keyed by name

Utility Functions

encodeHtmlEntities(text: string | null | undefined, options?: EncodeOptions): string

Encodes specific characters in a string into their HTML entity equivalents.

Options:

  • subset?: ('<' | '>' | '&' | '"' | "'")[] - Specify which characters to encode
  • encodeNonAscii?: boolean - Whether to encode non-ASCII characters

decodeHtmlEntities(text: string | null | undefined): string

Decodes HTML entities in a string into their corresponding characters.

getEntityByName(entityName: HtmlEntityName | string): HtmlEntity | undefined

Gets an HTML entity by its name.

getCharacterByEntityName(entityName: HtmlEntityName | string): string | undefined

Gets the decoded character for an HTML entity name.

Types

type HtmlEntityName = string; // e.g., '&nbsp;', '&lt;'
type DecodedCharacter = string; // e.g., '\u00A0', '<'

interface HtmlEntity {
  name: HtmlEntityName;
  character: DecodedCharacter;
  description: string;
  numericDecimal?: number;
  numericHex?: string;
}

interface EncodeOptions {
  subset?: ('<' | '>' | '&' | '"' | "'")[];
  encodeNonAscii?: boolean;
}

Data Source

The HTML entity data is sourced from the WHATWG HTML Living Standard.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.