micromark-util-decode-numeric-character-reference
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    micromark-util-decode-numeric-character-reference

    Build Coverage Downloads Size Sponsors Backers Chat

    micromark utility to decode numeric character references.

    Contents

    Install

    npm:

    npm install micromark-util-decode-numeric-character-reference

    Use

    import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'
    
    decodeNumericCharacterReference('41', 16) // 'A'
    decodeNumericCharacterReference('65', 10) // 'A'
    decodeNumericCharacterReference('A', 16) // '\n'
    decodeNumericCharacterReference('7F', 16) // '�' - Control
    decodeNumericCharacterReference('110000', 16) // '�' - Out of range

    API

    This module exports the following identifiers: decodeNumericCharacterReference. There is no default export.

    decodeNumericCharacterReference(value)

    Sort of like String.fromCharCode(Number.parseInt(value, base)), but makes non-characters and control characters safe.

    Parameters
    • value (string) — Value to decode.
    • base (number, probably 10 or 16) — Numeric base.
    Returns

    string — Character code.

    Security

    See security.md in micromark/.github for how to submit a security report.

    Contribute

    See contributing.md in micromark/.github for ways to get started. See support.md for ways to get help.

    This project has a code of conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

    License

    MIT © Titus Wormer

    Install

    npm i micromark-util-decode-numeric-character-reference

    DownloadsWeekly Downloads

    739,741

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    7.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • wooorm