kyrie
    Preparing search index...

    Function highlight_string

    • Highlights a JSON or JavaScript string with colors

      Parameters

      • str: string

        The string to highlight (JSON or JavaScript literal)

      • Optionaloptions: Options

        Optional configuration for highlighting

      Returns string

      The highlighted string with ANSI color codes

      const json = '{"name": "John", "age": 30}';
      const highlighted = highlight_string(json);
      console.log(highlighted); // Outputs colorized representation
      const arr = '[1, 2, 3, "hello", true]';
      const highlighted = highlight_string(arr, { palette: boldPalette });
      console.log(highlighted);