Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 901 Bytes

File metadata and controls

43 lines (32 loc) · 901 Bytes

bad-entity-decoder

This is a minimal html entity decoder, it's much worse than he, but it's also much smaller. Only use it if you know what you're doing™.

The he entity map is over 40 kB, this package has a small entity map which covers some of the popular entities only.

Pass it a bigger map if you need:

import { HtmlEntityDecoder } from 'bad-entitiy-decoder'

const extraEntities = { HilbertSpace: 'ℋ' }
const decoder = new HtmlEntityDecoder(extraEntities)
decoder.decode('ℋ')

Import entities from a sub-path:

import { LEGACY_NUMERIC, NAMED_ENTITIES } from 'bad-entitiy-decoder/entities'

Install

pnpm add bad-entity-decoder

Developing

pnpm i
pnpm lint
pnpm format
pnpm build
pnpm test
pnpm ncu # Update packages