Function manyTillOneOf

  • manyTillOneOf is an optimized version of manyTill. The manyTill combinator is slow because it runs the given parser on every character of the string until it succeeds. However, if you just want to consume input until you get to a substring, use manyTillOneOf. It uses indexOf, which is significantly faster than running a parser over every character.

    Given an array of strings, this parser consumes input until it hits one of those strings. If none of the strings is found, the parser will consume all input and return success.

    Parameters

    • stops: string[]
    • options: {
          insensitive?: boolean;
      } = {}

      object of optional parameters. { insensitive: boolean }

      • Optional insensitive?: boolean

    Returns Parser<string>

    a parser that consumes the input string until one of the given strings is found.

Generated using TypeDoc