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

symbolfyi

v0.1.2

Published

Pure TypeScript symbol encoder -- 11 encoding formats for any Unicode character. Zero dependencies.

Readme

symbolfyi

Pure TypeScript symbol encoder -- 11 encoding formats for any Unicode character. Zero dependencies.

npm version TypeScript License: MIT Zero Dependencies

Part of the FYIPedia open-source ecosystem. TypeScript port of the Python symbolfyi package.

Table of Contents

Features

  • 11 encoding formats for any Unicode character (BMP + supplementary plane)
  • 51 HTML entity mappings with bidirectional lookup
  • Unicode category detection using ES2018 Unicode property escapes
  • Zero dependencies -- pure TypeScript, works in Node.js and browsers
  • Full surrogate pair support for emoji and supplementary plane characters

Installation

npm install symbolfyi

Quick Start

import { getEncodings, getInfo, lookupHtmlEntity } from "symbolfyi";

// Encode any character into 11 formats
const enc = getEncodings("→");
enc.unicode     // "U+2192"
enc.htmlDecimal // "→"
enc.htmlHex     // "→"
enc.htmlEntity  // "→"
enc.css         // "\\2192"
enc.javascript  // "\\u{2192}"
enc.python      // "\\u2192"
enc.java        // "\\u2192"
enc.utf8Bytes   // "e2 86 92"
enc.utf16Bytes  // "21 92"
enc.urlEncoded  // "%E2%86%92"

// Get character info with category detection
const info = getInfo("$");
info?.category      // "Sc"
info?.categoryName  // "Currency Symbol"
info?.codepoint     // 36

// Look up HTML entities
lookupHtmlEntity("♥")  // "♥"
lookupHtmlEntity("amp")       // "&"

What You Can Do

Symbol Encoding

Encode any Unicode character into 11 different representations for use in HTML, CSS, JavaScript, Python, Java, and more. The encoder handles both BMP characters (U+0000-U+FFFF) and supplementary plane characters (U+10000+, including emoji) with correct surrogate pair encoding where needed.

| # | Format | BMP Example () | Supplementary Example (U+1F600) | Use Case | |---|--------|-------------------|----------------------------------|----------| | 1 | Unicode | U+2192 | U+1F600 | Documentation, character charts | | 2 | HTML Decimal | → | 😀 | HTML content (numeric reference) | | 3 | HTML Hex | → | 😀 | HTML content (hex reference) | | 4 | HTML Entity | → | (none) | HTML shorthand (51 common entities) | | 5 | CSS | \2192 | \1F600 | CSS content property | | 6 | JavaScript | \u{2192} | \u{1F600} | ES6+ string literals | | 7 | Python | \u2192 | \U0001f600 | Python string escapes | | 8 | Java | \u2192 | \uD83D\uDE00 | Java (surrogate pairs for U+10000+) | | 9 | UTF-8 Bytes | e2 86 92 | f0 9f 98 80 | Network protocols, file I/O | | 10 | UTF-16 Bytes | 21 92 | d8 3d de 00 | Windows APIs, Java internals | | 11 | URL Encoded | %E2%86%92 | %F0%9F%98%80 | URLs, query strings |

import { getEncodings } from "symbolfyi";

// Encode the rightwards arrow into all 11 formats
const enc = getEncodings("\u2192");
console.log(enc.unicode);      // "U+2192"
console.log(enc.htmlEntity);   // "→"
console.log(enc.css);          // "\\2192"
console.log(enc.javascript);   // "\\u{2192}"
console.log(enc.utf8Bytes);    // "e2 86 92"
console.log(enc.urlEncoded);   // "%E2%86%92"

Learn more: Symbol Encoder · HTML Entity Collections · Unicode Blocks

Unicode Properties

Every Unicode character belongs to one of 30 general categories (e.g., "Math Symbol", "Currency Symbol", "Uppercase Letter"). The getInfo() function returns the character's codepoint, category, human-readable category name, and all 11 encodings.

| Category Code | Category Name | Example Characters | |--------------|---------------|-------------------| | Lu | Uppercase Letter | A, B, C, ..., Z | | Ll | Lowercase Letter | a, b, c, ..., z | | Nd | Decimal Number | 0, 1, 2, ..., 9 | | Sm | Math Symbol | +, =, <, >, ~ | | Sc | Currency Symbol | $, EUR, GBP, JPY | | So | Other Symbol | (C), (R), (TM), ... | | Ps | Open Punctuation | (, [, { | | Pe | Close Punctuation | ), ], } |

import { getInfo, getCategoryName } from "symbolfyi";

// Get full Unicode properties for any character
const info = getInfo("$");
console.log(info?.codepoint);      // 36
console.log(info?.category);       // "Sc"
console.log(info?.categoryName);   // "Currency Symbol"
console.log(info?.encodings.htmlHex);  // "&#x24;"

// Look up category names
console.log(getCategoryName("Sm"));  // "Math Symbol"
console.log(getCategoryName("Lu"));  // "Uppercase Letter"
console.log(getCategoryName("Nd"));  // "Decimal Number"

Learn more: Unicode Category Reference · Unicode Blocks · REST API Docs

HTML Entity Lookup

Resolve 51 common HTML named entities back to their characters. Accepts bare names (amp), &-prefixed (&amp), or full format (&amp;).

import { lookupHtmlEntity, HTML_ENTITIES, HTML_ENTITY_TO_CHAR } from "symbolfyi";

// Reverse lookup: entity name to character
console.log(lookupHtmlEntity("&hearts;"));  // "heart character"
console.log(lookupHtmlEntity("amp"));       // "&"
console.log(lookupHtmlEntity("&rarr;"));    // "rightwards arrow"
console.log(lookupHtmlEntity("unknown"));   // null

// Direct data access
console.log(HTML_ENTITIES[0x2192]);           // "rarr"
console.log(HTML_ENTITY_TO_CHAR["rarr"]);     // "rightwards arrow character"

Learn more: HTML Entity Reference · Math Symbols · Currency Symbols

API Reference

getEncodings(char: string): EncodingInfo

Compute all 11 encoding representations for a single Unicode character.

| Property | Example () | Description | |----------|---------------|-------------| | unicode | U+2192 | Unicode codepoint notation | | htmlDecimal | &#8594; | HTML decimal entity | | htmlHex | &#x2192; | HTML hexadecimal entity | | htmlEntity | &rarr; | Named HTML entity (empty if none) | | css | \2192 | CSS escape sequence | | javascript | \u{2192} | JavaScript escape sequence | | python | \u2192 | Python escape (\U for supplementary) | | java | \u2192 | Java escape (surrogate pairs for supplementary) | | utf8Bytes | e2 86 92 | UTF-8 byte representation | | utf16Bytes | 21 92 | UTF-16 BE byte representation | | urlEncoded | %E2%86%92 | URL percent-encoded |

getInfo(char: string): SymbolInfo | null

Get Unicode character info including category and all encodings. Returns null for empty input.

interface SymbolInfo {
  codepoint: number;        // 8594
  character: string;        // "→"
  category: string;         // "Sm"
  categoryName: string;     // "Math Symbol"
  encodings: EncodingInfo;  // All 11 formats
}

getCategoryName(code: string): string

Get the full name for a Unicode general category code.

getCategoryName("Sm")  // "Math Symbol"
getCategoryName("Lu")  // "Uppercase Letter"
getCategoryName("Nd")  // "Decimal Number"

lookupHtmlEntity(entity: string): string | null

Look up the character for an HTML entity. Accepts bare names, &-prefixed, or full &...; format.

lookupHtmlEntity("amp")      // "&"
lookupHtmlEntity("&amp;")    // "&"
lookupHtmlEntity("&hearts;") // "♥"
lookupHtmlEntity("unknown")  // null

Data Exports

import { HTML_ENTITIES, HTML_ENTITY_TO_CHAR } from "symbolfyi";

// Codepoint → entity name
HTML_ENTITIES[0x2192]  // "rarr"

// Entity name → character
HTML_ENTITY_TO_CHAR["rarr"]  // "→"

Encoding Formats

| # | Format | BMP Example | Supplementary Example | |---|--------|-------------|----------------------| | 1 | Unicode | U+2192 | U+1F600 | | 2 | HTML Decimal | &#8594; | &#128512; | | 3 | HTML Hex | &#x2192; | &#x1F600; | | 4 | HTML Entity | &rarr; | (none) | | 5 | CSS | \2192 | \1F600 | | 6 | JavaScript | \u{2192} | \u{1F600} | | 7 | Python | \u2192 | \U0001f600 | | 8 | Java | \u2192 | \uD83D\uDE00 | | 9 | UTF-8 | e2 86 92 | f0 9f 98 80 | | 10 | UTF-16 | 21 92 | d8 3d de 00 | | 11 | URL | %E2%86%92 | %F0%9F%98%80 |

Supplementary Plane Support

Characters above U+FFFF (emoji, musical symbols, etc.) are fully supported:

const enc = getEncodings("\u{1F600}");  // 😀
enc.unicode     // "U+1F600"
enc.javascript  // "\\u{1F600}"
enc.python      // "\\U0001f600"
enc.java        // "\\uD83D\\uDE00"  (surrogate pair)
enc.utf8Bytes   // "f0 9f 98 80"
enc.utf16Bytes  // "d8 3d de 00"

Learn More About Symbols

Also Available

FYIPedia Developer Tools

Part of the FYIPedia open-source developer tools ecosystem.

| Package | PyPI | npm | Description | |---------|------|-----|-------------| | colorfyi | PyPI | npm | Color conversion, WCAG contrast, harmonies -- colorfyi.com | | emojifyi | PyPI | npm | Emoji encoding & metadata for 3,953 emojis -- emojifyi.com | | symbolfyi | PyPI | npm | Symbol encoding in 11 formats -- symbolfyi.com | | unicodefyi | PyPI | npm | Unicode lookup with 17 encodings -- unicodefyi.com | | fontfyi | PyPI | npm | Google Fonts metadata & CSS -- fontfyi.com | | distancefyi | PyPI | npm | Haversine distance & travel times -- distancefyi.com | | timefyi | PyPI | npm | Timezone ops & business hours -- timefyi.com | | namefyi | PyPI | npm | Korean romanization & Five Elements -- namefyi.com | | unitfyi | PyPI | npm | Unit conversion, 220 units -- unitfyi.com | | holidayfyi | PyPI | npm | Holiday dates & Easter calculation -- holidayfyi.com | | cocktailfyi | PyPI | -- | Cocktail ABV, calories, flavor -- cocktailfyi.com | | fyipedia | PyPI | -- | Unified CLI: fyi color info FF6B35 -- fyipedia.com | | fyipedia-mcp | PyPI | -- | Unified MCP hub for AI assistants -- fyipedia.com |

License

MIT -- FYIPedia