isMatch = (text, pattern) => {
    const isBaseCase = (pattern.length === 0);
    if (isBaseCase) return (text.length === 0);

    const isTextAndPatternEqual = (pattern[0] === text[0]),
        isPatternPeriod = (pattern[0] === '.'),
        isFirstMatch = (text && (isTextAndPatternEqual || isPatternPeriod)),
        isNextPatternWildCard = (pattern.length >= 2 && pattern[1] === '*');

    return isNextPatternWildCard/* Time O((N + M) * 2^(N + (M / 2))) | Space O(N^2 + M^2) */
        ? (isMatch(text, pattern.slice(2)) || (isFirstMatch && isMatch(text.slice(1), pattern)))
        : (isFirstMatch && isMatch(text.slice(1), pattern.slice(1)));
}
Brute Force - DFS
Time O((N + M) * 2^(N + (M / 2))) | Space O(N^2 + M^2)
https://leetcode.com/problems/regular-expression-matching/
@param {string} s
@param {string} p
@return {boolean}