@squishyu/decode-named-character-reference
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

decode-named-character-reference

Build Status Coverage Status Downloads Size

Modified version of wooorm/decode-named-character-reference

Fixes a specific use case when directly or indirectly importing this library from a web worker in a Vite project by moving the module-level document.createElement statement into the main function.


Decode named character references.

Contents

What is this?

A workaround for webpack.

When should I use this?

Never use this. Use parse-entities. It uses this.

Install

This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:

npm install decode-named-character-reference

In Deno with esm.sh:

import {decodeNamedCharacterReference} from 'https://esm.sh/decode-named-character-reference@1'

In browsers with esm.sh:

<script type="module">
  import {decodeNamedCharacterReference} from 'https://esm.sh/decode-named-character-reference@1?bundle'
</script>

Use

import {decodeNamedCharacterReference} from 'decode-named-character-reference'

decodeNamedCharacterReference('amp') //=> '&'

API

This package exports the identifier decodeNamedCharacterReference. There is no default export.

decodeNamedCharacterReference(value)

Again, use parse-entities.

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.

Security

This package is safe.

Contribute

Yes please! See How to Contribute to Open Source.

License

MIT © Titus Wormer

Package Sidebar

Install

npm i @squishyu/decode-named-character-reference

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

9.65 kB

Total Files

7

Last publish

Collaborators

  • squishyu