Optional
includeWhether the returned sequence is to include the next character (if any) after the longest knowable sequence.
The next character after the longest knowable sequence is either:
(ab)c
-> [/a/, /b/, /c/]
),ab(cd|ef)
-> [/a/, /b/, /[ce]/]
), orNote that enabling this options means that the returned sequence of character sets is no longer guaranteed to be a prefix of the given alternative.
false
Optional
looseWhether groups will be combined more loosely.
With this option disabled, groups will only be combined if they are of
the same length and differ in at most one position. E.g. the longest
prefix of /(?:bitter|barber)/
is [/b/, /[ia]/]
. This requirement is
very strict and most groups do not fulfill it in practice.
With this option enabled, groups will be combined if they are of the
same length. Different characters at the same position are simply
combined. E.g. the longest prefix /(?:bitter|barber)/
is
[/b/, /[ia]/, /[tr]/, /[tb]/, /e/, /r/]
. With this option enabled, the
returned prefix is only guaranteed to be a superset of the actual strict
longest prefix.
The purpose of this option is to provide longer prefixes in use cases where an approximation of the actual prefix is good enough.
false
Optional
onlyWhether only characters inside the given alternative may be considered when creating the last character.
This option control the behavior of includeAfter. By default, includeAfter will also look at the characters after the alternative to create the last character. This may be undesirable in some case.
The enabling this option has the following effect: If the last character
of the prefix is affected by characters outside the alternative, then
the prefix with includeAfter set to false
will be returned.
false
Options to control the behavior of getLongestPrefix.