• Returns the string that replaced all occurrences in the given text

    Parameters

    • Optionaltext: null | string

      the text to inspect

    • Optionalsearch: null | string | RegExp

      the string or regex to match

    • Optionalreplace: null | string

      the expected replacement string

    Returns string | undefined | null

    the string that replaced all occurrences in the given text

    replaceAll(undefined, undefined, undefined);    // undefined
    replaceAll('foobar-foobar', undefined, 'hello'); // 'foobar-foobar'
    replaceAll('foobar-foobar', 'foobar', 'hello'); // 'hello-hello'