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

@bybrave/he2

v2.0.1

Published

Maintained he fork: robust HTML entity encoder/decoder with full Unicode support, now as ESM + CommonJS with built-in TypeScript types and zero dependencies. Drop-in for he.

Downloads

144

Readme

@bybrave/he2

Maintained fork of he — a robust HTML entity encoder/decoder with full Unicode support.

Same battle-tested, HTML-spec-compliant engine, now shipped as native ESM + CommonJS with built-in TypeScript types, zero dependencies, and the he CLI. Encode/decode output is byte-for-byte identical to [email protected].

Install

npm install @bybrave/he2

Usage

import he from '@bybrave/he2';
// or: import { encode, decode, escape, unescape } from '@bybrave/he2';

he.encode('foo © bar ≠ baz 𝌆 qux', { useNamedReferences: true });
// → 'foo © bar ≠ baz 𝌆 qux'

he.decode('foo © bar ≠ baz 𝌆 qux');
// → 'foo © bar ≠ baz 𝌆 qux'

he.escape('<img src="x">');
// → '&lt;img src=&quot;x&quot;&gt;'

CommonJS works too — require returns the same { encode, decode, escape, unescape, version } object as the original:

const he = require('@bybrave/he2');

API

  • encode(text, options?) — options: useNamedReferences, decimal, encodeEverything, strict, allowUnsafeSymbols.
  • decode(html, options?) — options: isAttributeValue, strict.
  • escape(text) — escapes only &<>"' and backtick.
  • unescape(html, options?) — alias of decode.
  • version — the underlying he version.

CLI

he --escape '<img src="x">'
echo '&copy; &#x1D306;' | he --decode

What's changed vs [email protected]

| Change | Detail | |---|---| | ESM + CommonJS | Ships native ESM with a CommonJS build via the exports map — import and require both work. The original was UMD only. | | Built-in types | TypeScript types are bundled — no separate @types/he needed. | | Zero dependencies | Same as the original (no runtime deps), now maintained. | | Engine unchanged | The HTML-spec engine and generated Unicode tables are ported byte-for-byte; encode/decode/escape output matches [email protected] exactly. |

Migration from he

Drop-in — replace the import:

- const he = require('he');
+ const he = require('@bybrave/he2');

All output is identical to [email protected]. Unlike entities or html-entities, this keeps the exact he API (encode/decode/escape/unescape with the same options), so no code changes are needed.

Support

If this package saves you time, you can support maintenance:

Ko-fi Bitcoin

Bitcoin (BTC): bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q

License

MIT. Copyright © Mathias Bynens; fork © bybrave.