getIndexOfLastLine(text) {

        /**
         * Helper function get the last match as string
         * @param {string} haystack
         * @param {string | RegExp} needle
         * @returns {string | undefined}
         */
        const getLastMatch = (haystack, needle) => {
            const matches = haystack.match(needle);
            if (matches === null) {
                return;
            }

            return matches[matches.length - 1];
        };

        const endSep = getLastMatch(text, this.separator);

        if (!endSep) return null;

        const endSepIndex = text.lastIndexOf(endSep);
        let lastLine;

        if (text.endsWith(endSep)) {
            // If the text ends with a separator, look back further to find the next
            // separator to complete the line

            const trimmed = text.substring(0, endSepIndex);
            const startSep = getLastMatch(trimmed, this.separator);

            // If there isn't another separator, the line isn't complete so
            // so return null to get more data

            if (!startSep) {
                return null;
            }

            const startSepIndex = trimmed.lastIndexOf(startSep);

            // Exclude the starting separator, include the ending separator

            lastLine = text.substring(
                startSepIndex + startSep.length,
                endSepIndex + endSep.length
            );
        } else {
            // If the text does not end with a separator, grab everything after
            // the last separator
            lastLine = text.substring(endSepIndex + endSep.length);
        }

        return text.lastIndexOf(lastLine);
    }
Grabs the index of the last line of text in the format /.*(\n)?/.
Returns null if a full line can not be found.
@param {string} text
@returns {number | null}