Type Alias MatchOptions

MatchOptions: {
    fallback: string;
    fromEnd: boolean;
    ifNoMatch: "throw" | "original" | "fallback";
    startPos: number;
}

Returns the source string up until (and excluding) match.

By default, if match is not found, all of source is returned.

// Yields `apple `
untilMarch(`apple orange melon`, `orange`);

If match is not found, fallback can be returned instead:

// Yields 'lemon'
untilMatch(`apple orange mellon`, `kiwi`, { fallback: `lemon` });

Or an exception thrown

// Throws
untilMatch(`apple orange mellon`, `kiwi`, { ifNoMatch: `throw` });

If provided, gives the starting offset. Default 0