manyTillStr 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
manyTillStr. It uses indexOf, which
is significantly faster than running a parser over every
character.
Parameters
str:
string
the string to stop at
options:
{ insensitive?: boolean; } = {}
object of optional parameters. { insensitive: boolean }
manyTillStris an optimized version ofmanyTill. ThemanyTillcombinator 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, usemanyTillStr. It usesindexOf, which is significantly faster than running a parser over every character.