Custom String Formatter API
    Preparing search index...

    Function decodeFilterArg

    • Helper for decoding HTML-encoded symbols inside a string.

      This is almost a generic decoder for HTML-encoded symbols, supporting decimal and hexadecimal codes, plus optional removal of accents (diacritical marks) from letters. However, it does not support HTML entity names, like &, etc., as its main purpose is to decode filter arguments (not full HTML documents), so it prioritizes performance over universality.

      Parameters

      • arg: string

        A string that contains HTML-encoded symbols, like this:

        • { - decimal symbol code (1-6 digits);
        • ƣ - hexadecimal symbol code (1-5 hex digits, case-insensitive);
      • removeAccents: boolean = false

        Optional accents (diacritical marks) removal from letters, if truthy. Default is false.

      Returns string

      Decoded string.

      import {decodeFilterArg} from 'custom-string-formatter';

      decodeFilterArg('some (text)'); //=> some (text)

      decodeFilterArg('sòmê &#60;téxt&#62;'); //=> sòmê <téxt>

      decodeFilterArg('sòmê &#60;téxt&#62;', true); //=> some <text>