JSPM

tiny-decode

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 655
  • Score
    100M100P100Q100279F
  • License MIT

Decode HTML entities the browser-friendly way

Package Exports

  • tiny-decode

Readme

tiny-decode

Decoding HTML named character references traditionally requires a large table to store entity names and the code points to which they refer. Unless you take extreme care, this data can easily end up in your JavaScript bundle.

tiny-decode takes advantage of export conditions to include only as much JavaScript as necessary. For bundled browser code, the decode function is only a few bytes. For server-side code, decode includes the full entities module, which is much larger.

Example

Bundle `entities`     18.52 kB │ gzip: 19.64 kB
Bundle `tiny-decode`   0.97 kB │ gzip: 0.56 kB