@nevware21/chromacon
    Preparing search index...

    Function replaceAnsi

    • Replaces ANSI escape sequences in a string with a specified replacement, either by using a replacement string or a replacement function.

      Parameters

      • value: string

        The string containing ANSI escape sequences to be replaced.

      • replacer: string | ReplacerFn

        A function or string used to replace the ANSI escape sequences.

      Returns string

      The string with ANSI escape sequences replaced.

      0.1.3

      replaceAnsi("\u001b[31mHello\u001b[39m", (substring) => substring === "\u001b[31m" ? "" : substring);
      replaceAnsi("\u001b[31mHello\u001b[39m", "");
      replaceAnsi("\u001b[31mHello\u001b[39m", (substring, offset, string) => {
      console.log(substring, offset, string);
      return "";
      });