html-entities

  • Version 2.5.2
  • Published
  • 287 kB
  • No dependencies
  • MIT license

Install

npm i html-entities
yarn add html-entities
pnpm add html-entities

Overview

Fastest HTML entities encode/decode library.

Index

Functions

function decode

decode: (
text: string | undefined | null,
{ level, scope }?: DecodeOptions
) => string;
  • Decodes all entities in the text

function decodeEntity

decodeEntity: (
entity: string | undefined | null,
{ level }?: CommonOptions
) => string;
  • Decodes a single entity

function encode

encode: (
text: string | undefined | null,
{ mode, numeric, level }?: EncodeOptions
) => string;
  • Encodes all the necessary (specified by level) characters in the text

Interfaces

interface DecodeOptions

interface DecodeOptions extends CommonOptions {}

    property scope

    scope?: DecodeScope;

      interface EncodeOptions

      interface EncodeOptions extends CommonOptions {}

        property mode

        mode?: EncodeMode;

          property numeric

          numeric?: 'decimal' | 'hexadecimal';

            Type Aliases

            type DecodeScope

            type DecodeScope = 'strict' | 'body' | 'attribute';

              type EncodeMode

              type EncodeMode =
              | 'specialChars'
              | 'nonAscii'
              | 'nonAsciiPrintable'
              | 'nonAsciiPrintableOnly'
              | 'extensive';

                type Level

                type Level = 'xml' | 'html4' | 'html5' | 'all';

                  Package Files (1)

                  Dependencies (0)

                  No dependencies.

                  Dev Dependencies (22)

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/html-entities.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/html-entities)
                  • HTML
                    <a href="https://www.jsdocs.io/package/html-entities"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>